[feature] Allow users to submit interaction_policy on new statuses (#3314)

* [feature] Parse `interaction_policy` on status submission

* beep boop

* swagger? i barely know er
This commit is contained in:
tobi
2024-09-18 18:35:35 +02:00
committed by GitHub
parent f819229988
commit c378ad2bb3
6 changed files with 1342 additions and 413 deletions

View File

@@ -8826,11 +8826,27 @@ paths:
post:
consumes:
- application/json
- application/xml
- application/x-www-form-urlencoded
description: |-
The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'.
The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'.
The 'interaction_policy' field can be used to set an interaction policy for this status.
If submitting using form data, use the following pattern to set an interaction policy:
`interaction_policy[INTERACTION_TYPE][CONDITION][INDEX]=Value`
For example: `interaction_policy[can_reply][always][0]=author`
Using `curl` this might look something like:
`curl -F 'interaction_policy[can_reply][always][0]=author' -F 'interaction_policy[can_reply][always][1]=followers' [... other form fields ...]`
The JSON equivalent would be:
`curl -H 'Content-Type: application/json' -d '{"interaction_policy":{"can_reply":{"always":["author","followers"]}} [... other json fields ...]}'`
The server will perform some normalization on the submitted policy so that you can't submit something totally invalid.
operationId: statusCreate
parameters:
- description: |-
@@ -8944,6 +8960,30 @@ paths:
name: content_type
type: string
x-go-name: ContentType
- description: Nth entry for interaction_policy.can_favourite.always.
in: formData
name: interaction_policy[can_favourite][always][0]
type: string
- description: Nth entry for interaction_policy.can_favourite.with_approval.
in: formData
name: interaction_policy[can_favourite][with_approval][0]
type: string
- description: Nth entry for interaction_policy.can_reply.always.
in: formData
name: interaction_policy[can_reply][always][0]
type: string
- description: Nth entry for interaction_policy.can_reply.with_approval.
in: formData
name: interaction_policy[can_reply][with_approval][0]
type: string
- description: Nth entry for interaction_policy.can_reblog.always.
in: formData
name: interaction_policy[can_reblog][always][0]
type: string
- description: Nth entry for interaction_policy.can_reblog.with_approval.
in: formData
name: interaction_policy[can_reblog][with_approval][0]
type: string
produces:
- application/json
responses:
@@ -8966,7 +9006,7 @@ paths:
security:
- OAuth2 Bearer:
- write:statuses
summary: Create a new status.
summary: Create a new status using the given form field parameters.
tags:
- statuses
/api/v1/statuses/{id}: