summaryrefslogtreecommitdiff
path: root/docs/api
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-01-23 13:14:21 +0100
committerLibravatar GitHub <noreply@github.com>2023-01-23 13:14:21 +0100
commite9747247d58a0423d5e40fda5c5b37b4b4526495 (patch)
tree5574b05f1dec1ad88c49b9891f1e54719f1b9eb1 /docs/api
parent[chore] bump go version to 1.19.5 (#1377) (diff)
downloadgotosocial-e9747247d58a0423d5e40fda5c5b37b4b4526495.tar.xz
[feature] Implement `/api/v1/reports` endpoints on client API (#1330)
* start adding report client api * route + test reports get * start report create endpoint * you can create reports now babyy * stub account report processor * add single reportGet endpoint * fix test * add more filtering params to /api/v1/reports GET * update swagger * use marshalIndent in tests * add + test missing Link info
Diffstat (limited to 'docs/api')
-rw-r--r--docs/api/swagger.yaml256
1 files changed, 256 insertions, 0 deletions
diff --git a/docs/api/swagger.yaml b/docs/api/swagger.yaml
index b3a75d177..9182f48c8 100644
--- a/docs/api/swagger.yaml
+++ b/docs/api/swagger.yaml
@@ -1510,6 +1510,83 @@ definitions:
type: object
x-go-name: PollOptions
x-go-package: github.com/superseriousbusiness/gotosocial/internal/api/model
+ report:
+ properties:
+ action_taken:
+ description: Whether an action has been taken by an admin in response to this report.
+ example: false
+ type: boolean
+ x-go-name: ActionTaken
+ action_taken_at:
+ description: |-
+ If an action was taken, at what time was this done? (ISO 8601 Datetime)
+ Will be null if not set / no action yet taken.
+ example: "2021-07-30T09:20:25+00:00"
+ type: string
+ x-go-name: ActionTakenAt
+ action_taken_comment:
+ description: |-
+ If an action was taken, what comment was made by the admin on the taken action?
+ Will be null if not set / no action yet taken.
+ example: Account was suspended.
+ type: string
+ x-go-name: ActionComment
+ category:
+ description: Under what category was this report created?
+ example: spam
+ type: string
+ x-go-name: Category
+ comment:
+ description: |-
+ Comment submitted when the report was created.
+ Will be empty if no comment was submitted.
+ example: This person has been harassing me.
+ type: string
+ x-go-name: Comment
+ created_at:
+ description: The date when this report was created (ISO 8601 Datetime).
+ example: "2021-07-30T09:20:25+00:00"
+ type: string
+ x-go-name: CreatedAt
+ forwarded:
+ description: Bool to indicate that report should be federated to remote instance.
+ example: true
+ type: boolean
+ x-go-name: Forwarded
+ id:
+ description: ID of the report.
+ example: 01FBVD42CQ3ZEEVMW180SBX03B
+ type: string
+ x-go-name: ID
+ rule_ids:
+ description: |-
+ Array of rule IDs that were submitted along with this report.
+ Will be empty if no rule IDs were submitted.
+ example:
+ - 1
+ - 2
+ items:
+ format: int64
+ type: integer
+ type: array
+ x-go-name: RuleIDs
+ status_ids:
+ description: |-
+ Array of IDs of statuses that were submitted along with this report.
+ Will be empty if no status IDs were submitted.
+ example:
+ - 01GPBN5YDY6JKBWE44H7YQBDCQ
+ - 01GPBN65PDWSBPWVDD0SQCFFY3
+ items:
+ type: string
+ type: array
+ x-go-name: StatusIDs
+ target_account:
+ $ref: '#/definitions/account'
+ title: Report models a moderation report submitted to the instance, either via the client API or via the federated API.
+ type: object
+ x-go-name: Report
+ x-go-package: github.com/superseriousbusiness/gotosocial/internal/api/model
searchResult:
properties:
accounts:
@@ -3897,6 +3974,185 @@ paths:
summary: Clear/delete all notifications for currently authorized user.
tags:
- notifications
+ /api/v1/reports:
+ get:
+ description: |-
+ The reports will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer).
+
+ The next and previous queries can be parsed from the returned Link header.
+
+ Example:
+
+ ```
+ <https://example.org/api/v1/reports?limit=20&max_id=01FC0SKA48HNSVR6YKZCQGS2V8>; rel="next", <https://example.org/api/v1/reports?limit=20&min_id=01FC0SKW5JK2Q4EVAV2B462YY0>; rel="prev"
+ ````
+ operationId: reports
+ parameters:
+ - description: If set to true, only resolved reports will be returned. If false, only unresolved reports will be returned. If unset, reports will not be filtered on their resolved status.
+ in: query
+ name: resolved
+ type: boolean
+ - description: Return only reports that target the given account id.
+ in: query
+ name: target_account_id
+ type: string
+ - description: Return only reports *OLDER* than the given max ID. The report with the specified ID will not be included in the response.
+ in: query
+ name: max_id
+ type: string
+ - description: Return only reports *NEWER* than the given since ID. The report with the specified ID will not be included in the response. This parameter is functionally equivalent to min_id.
+ in: query
+ name: since_id
+ type: string
+ - description: Return only reports *NEWER* than the given min ID. The report with the specified ID will not be included in the response. This parameter is functionally equivalent to since_id.
+ in: query
+ name: min_id
+ type: string
+ - default: 20
+ description: Number of reports to return. If less than 1, will be clamped to 1. If more than 100, will be clamped to 100.
+ in: query
+ name: limit
+ type: integer
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: Array of reports.
+ schema:
+ items:
+ $ref: '#/definitions/report'
+ type: array
+ "400":
+ description: bad request
+ "401":
+ description: unauthorized
+ "404":
+ description: not found
+ "406":
+ description: not acceptable
+ "500":
+ description: internal server error
+ security:
+ - OAuth2 Bearer:
+ - read:reports
+ summary: See reports created by the requesting account.
+ tags:
+ - reports
+ post:
+ consumes:
+ - application/json
+ - application/xml
+ - application/x-www-form-urlencoded
+ operationId: reportCreate
+ parameters:
+ - description: ID of the account to report.
+ example: 01GPE75FXSH2EGFBF85NXPH3KP
+ in: formData
+ name: account_id
+ required: true
+ type: string
+ x-go-name: AccountID
+ - description: IDs of statuses to attach to the report to provide additional context.
+ example:
+ - 01GPE76N4SBVRZ8K24TW51ZZQ4
+ - 01GPE76WN9JZE62EPT3Q9FRRD4
+ in: formData
+ items:
+ type: string
+ name: status_ids
+ type: array
+ x-go-name: StatusIDs
+ - description: The reason for the report. Default maximum of 1000 characters.
+ example: Anti-Blackness, transphobia.
+ in: formData
+ name: comment
+ type: string
+ x-go-name: Comment
+ - default: false
+ description: If the account is remote, should the report be forwarded to the remote admin?
+ example: true
+ in: formData
+ name: forward
+ type: boolean
+ x-go-name: Forward
+ - default: other
+ description: |-
+ Specify if the report is due to spam, violation of enumerated instance rules, or some other reason.
+ Currently only 'other' is supported.
+ example: other
+ in: formData
+ name: category
+ type: string
+ x-go-name: Category
+ - description: |-
+ IDs of rules on this instance which have been broken according to the reporter.
+ This is currently not supported, provided only for API compatibility.
+ example:
+ - 1
+ - 2
+ - 3
+ in: formData
+ items:
+ format: int64
+ type: integer
+ name: rule_ids
+ type: array
+ x-go-name: RuleIDs
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: The created report.
+ schema:
+ $ref: '#/definitions/report'
+ "400":
+ description: bad request
+ "401":
+ description: unauthorized
+ "404":
+ description: not found
+ "406":
+ description: not acceptable
+ "500":
+ description: internal server error
+ security:
+ - OAuth2 Bearer:
+ - write:reports
+ summary: Create a new user report with the given parameters.
+ tags:
+ - reports
+ /api/v1/reports/{id}:
+ get:
+ operationId: reportGet
+ parameters:
+ - description: ID of the report
+ in: path
+ name: id
+ required: true
+ type: string
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: The requested report.
+ schema:
+ $ref: '#/definitions/report'
+ "400":
+ description: bad request
+ "401":
+ description: unauthorized
+ "404":
+ description: not found
+ "406":
+ description: not acceptable
+ "500":
+ description: internal server error
+ security:
+ - OAuth2 Bearer:
+ - read:reports
+ summary: Get one report with the given id.
+ tags:
+ - reports
/api/v1/search:
get:
description: If statuses are in the result, they will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer).