mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[chore] update dependencies, bump to Go 1.19.1 (#826)
* update dependencies, bump Go version to 1.19 * bump test image Go version * update golangci-lint * update gotosocial-drone-build * sign * linting, go fmt * update swagger docs * update swagger docs * whitespace * update contributing.md * fuckin whoopsie doopsie * linterino, linteroni * fix followrequest test not starting processor * fix other api/client tests not starting processor * fix remaining tests where processor not started * bump go-runners version * don't check last-webfingered-at, processor may have updated this * update swagger command * update bun to latest version * fix embed to work the same as before with new bun Signed-off-by: kim <grufwub@gmail.com> Co-authored-by: tsmethurst <tobi.smethurst@protonmail.com>
This commit is contained in:
@@ -74,6 +74,8 @@ func (suite *AccountStandardTestSuite) SetupTest() {
|
||||
suite.accountModule = account.New(suite.processor).(*account.Module)
|
||||
testrig.StandardDBSetup(suite.db, nil)
|
||||
testrig.StandardStorageSetup(suite.storage, "../../../../testrig/media")
|
||||
|
||||
suite.NoError(suite.processor.Start())
|
||||
}
|
||||
|
||||
func (suite *AccountStandardTestSuite) TearDownTest() {
|
||||
|
@@ -39,37 +39,37 @@ import (
|
||||
// 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'.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
//
|
||||
// consumes:
|
||||
// - application/json
|
||||
// - application/xml
|
||||
// - application/x-www-form-urlencoded
|
||||
// consumes:
|
||||
// - application/json
|
||||
// - application/xml
|
||||
// - application/x-www-form-urlencoded
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Application:
|
||||
// - write:accounts
|
||||
// security:
|
||||
// - OAuth2 Application:
|
||||
// - write:accounts
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: "An OAuth2 access token for the newly-created account."
|
||||
// schema:
|
||||
// "$ref": "#/definitions/oauthToken"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: "An OAuth2 access token for the newly-created account."
|
||||
// schema:
|
||||
// "$ref": "#/definitions/oauthToken"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) AccountCreatePOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, false, false)
|
||||
if err != nil {
|
||||
|
@@ -33,37 +33,38 @@ import (
|
||||
//
|
||||
// Delete your account.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
//
|
||||
// consumes:
|
||||
// - multipart/form-data
|
||||
// consumes:
|
||||
// - multipart/form-data
|
||||
//
|
||||
// parameters:
|
||||
// - name: password
|
||||
// in: formData
|
||||
// description: Password of the account user, for confirmation.
|
||||
// type: string
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: password
|
||||
// in: formData
|
||||
// description: Password of the account user, for confirmation.
|
||||
// type: string
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:accounts
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:accounts
|
||||
//
|
||||
// responses:
|
||||
// '202':
|
||||
// description: "The account deletion has been accepted and the account will be deleted."
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '202':
|
||||
// description: "The account deletion has been accepted and the account will be deleted."
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) AccountDeletePOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -32,38 +32,40 @@ import (
|
||||
//
|
||||
// Get information about an account with the given ID.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// type: string
|
||||
// description: The id of the requested account.
|
||||
// in: path
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// type: string
|
||||
// description: The id of the requested account.
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:accounts
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:accounts
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// schema:
|
||||
// "$ref": "#/definitions/account"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: The requested account.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/account"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) AccountGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -35,89 +35,101 @@ import (
|
||||
//
|
||||
// Update your account.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
//
|
||||
// consumes:
|
||||
// - multipart/form-data
|
||||
// consumes:
|
||||
// - multipart/form-data
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: discoverable
|
||||
// in: formData
|
||||
// description: Account should be made discoverable and shown in the profile directory (if enabled).
|
||||
// type: boolean
|
||||
// - name: bot
|
||||
// in: formData
|
||||
// description: Account is flagged as a bot.
|
||||
// type: boolean
|
||||
// - name: display_name
|
||||
// in: formData
|
||||
// description: The display name to use for the account.
|
||||
// type: string
|
||||
// allowEmptyValue: true
|
||||
// - name: note
|
||||
// in: formData
|
||||
// description: Bio/description of this account.
|
||||
// type: string
|
||||
// allowEmptyValue: true
|
||||
// - name: avatar
|
||||
// in: formData
|
||||
// description: Avatar of the user.
|
||||
// type: file
|
||||
// - name: header
|
||||
// in: formData
|
||||
// description: Header of the user.
|
||||
// type: file
|
||||
// - name: locked
|
||||
// in: formData
|
||||
// description: Require manual approval of follow requests.
|
||||
// type: boolean
|
||||
// - name: source[privacy]
|
||||
// in: formData
|
||||
// description: Default post privacy for authored statuses.
|
||||
// type: string
|
||||
// - name: source[sensitive]
|
||||
// in: formData
|
||||
// description: Mark authored statuses as sensitive by default.
|
||||
// type: boolean
|
||||
// - name: source[language]
|
||||
// in: formData
|
||||
// description: Default language to use for authored statuses (ISO 6391).
|
||||
// type: string
|
||||
// - name: source[status_format]
|
||||
// in: formData
|
||||
// description: Default format to use for authored statuses (plain or markdown).
|
||||
// type: string
|
||||
// - name: custom_css
|
||||
// in: formData
|
||||
// description: |-
|
||||
// Custom CSS to use when rendering this account's profile or statuses.
|
||||
// String must be no more than 5,000 characters (~5kb).
|
||||
// type: string
|
||||
// parameters:
|
||||
// -
|
||||
// name: discoverable
|
||||
// in: formData
|
||||
// description: Account should be made discoverable and shown in the profile directory (if enabled).
|
||||
// type: boolean
|
||||
// -
|
||||
// name: bot
|
||||
// in: formData
|
||||
// description: Account is flagged as a bot.
|
||||
// type: boolean
|
||||
// -
|
||||
// name: display_name
|
||||
// in: formData
|
||||
// description: The display name to use for the account.
|
||||
// type: string
|
||||
// allowEmptyValue: true
|
||||
// -
|
||||
// name: note
|
||||
// in: formData
|
||||
// description: Bio/description of this account.
|
||||
// type: string
|
||||
// allowEmptyValue: true
|
||||
// -
|
||||
// name: avatar
|
||||
// in: formData
|
||||
// description: Avatar of the user.
|
||||
// type: file
|
||||
// -
|
||||
// name: header
|
||||
// in: formData
|
||||
// description: Header of the user.
|
||||
// type: file
|
||||
// -
|
||||
// name: locked
|
||||
// in: formData
|
||||
// description: Require manual approval of follow requests.
|
||||
// type: boolean
|
||||
// -
|
||||
// name: source[privacy]
|
||||
// in: formData
|
||||
// description: Default post privacy for authored statuses.
|
||||
// type: string
|
||||
// -
|
||||
// name: source[sensitive]
|
||||
// in: formData
|
||||
// description: Mark authored statuses as sensitive by default.
|
||||
// type: boolean
|
||||
// -
|
||||
// name: source[language]
|
||||
// in: formData
|
||||
// description: Default language to use for authored statuses (ISO 6391).
|
||||
// type: string
|
||||
// -
|
||||
// name: source[status_format]
|
||||
// in: formData
|
||||
// description: Default format to use for authored statuses (plain or markdown).
|
||||
// type: string
|
||||
// -
|
||||
// name: custom_css
|
||||
// in: formData
|
||||
// description: >-
|
||||
// Custom CSS to use when rendering this account's profile or statuses.
|
||||
// String must be no more than 5,000 characters (~5kb).
|
||||
// type: string
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:accounts
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:accounts
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: "The newly updated account."
|
||||
// schema:
|
||||
// "$ref": "#/definitions/account"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: "The newly updated account."
|
||||
// schema:
|
||||
// "$ref": "#/definitions/account"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) AccountUpdateCredentialsPATCHHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -31,31 +31,31 @@ import (
|
||||
//
|
||||
// Verify a token by returning account details pertaining to it.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:accounts
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:accounts
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// schema:
|
||||
// "$ref": "#/definitions/account"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// schema:
|
||||
// "$ref": "#/definitions/account"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) AccountVerifyGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -32,40 +32,40 @@ import (
|
||||
//
|
||||
// Block account with id.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// type: string
|
||||
// description: The id of the account to block.
|
||||
// in: path
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// type: string
|
||||
// description: The id of the account to block.
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:blocks
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:blocks
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// name: account relationship
|
||||
// description: Your relationship to this account.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/accountRelationship"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: Your relationship to the account.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/accountRelationship"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) AccountBlockPOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -36,57 +36,58 @@ import (
|
||||
// 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'.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
//
|
||||
// consumes:
|
||||
// - application/json
|
||||
// - application/xml
|
||||
// - application/x-www-form-urlencoded
|
||||
// consumes:
|
||||
// - application/json
|
||||
// - application/xml
|
||||
// - application/x-www-form-urlencoded
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// required: true
|
||||
// in: path
|
||||
// description: ID of the account to follow.
|
||||
// type: string
|
||||
// - default: true
|
||||
// description: Show reblogs from this account.
|
||||
// in: formData
|
||||
// name: reblogs
|
||||
// type: boolean
|
||||
// x-go-name: Reblogs
|
||||
// - default: false
|
||||
// description: Notify when this account posts.
|
||||
// in: formData
|
||||
// name: notify
|
||||
// type: boolean
|
||||
// x-go-name: Notify
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// required: true
|
||||
// in: path
|
||||
// description: ID of the account to follow.
|
||||
// type: string
|
||||
// -
|
||||
// name: reblogs
|
||||
// type: boolean
|
||||
// default: true
|
||||
// description: Show reblogs from this account.
|
||||
// in: formData
|
||||
// -
|
||||
// default: false
|
||||
// description: Notify when this account posts.
|
||||
// in: formData
|
||||
// name: notify
|
||||
// type: boolean
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:follows
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:follows
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// name: account relationship
|
||||
// description: Your relationship to this account.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/accountRelationship"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// name: account relationship
|
||||
// description: Your relationship to this account.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/accountRelationship"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) AccountFollowPOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -32,42 +32,43 @@ import (
|
||||
//
|
||||
// See followers of account with given id.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// type: string
|
||||
// description: Account ID.
|
||||
// in: path
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// type: string
|
||||
// description: Account ID.
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:accounts
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:accounts
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// name: accounts
|
||||
// description: Array of accounts that follow this account.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/account"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// name: accounts
|
||||
// description: Array of accounts that follow this account.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/account"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) AccountFollowersGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -32,42 +32,43 @@ import (
|
||||
//
|
||||
// See accounts followed by given account id.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// type: string
|
||||
// description: Account ID.
|
||||
// in: path
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// type: string
|
||||
// description: Account ID.
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:accounts
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:accounts
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// name: accounts
|
||||
// description: Array of accounts that are followed by this account.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/account"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// name: accounts
|
||||
// description: Array of accounts that are followed by this account.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/account"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) AccountFollowingGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -15,44 +15,45 @@ import (
|
||||
//
|
||||
// See your account's relationships with the given account IDs.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// type: array
|
||||
// items:
|
||||
// type: string
|
||||
// description: Account IDs.
|
||||
// in: query
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// type: array
|
||||
// items:
|
||||
// type: string
|
||||
// description: Account IDs.
|
||||
// in: query
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:accounts
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:accounts
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// name: account relationships
|
||||
// description: Array of account relationships.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/accountRelationship"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// name: account relationships
|
||||
// description: Array of account relationships.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/accountRelationship"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) AccountRelationshipsGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -36,91 +36,100 @@ import (
|
||||
//
|
||||
// The statuses will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer).
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// type: string
|
||||
// description: Account ID.
|
||||
// in: path
|
||||
// required: true
|
||||
// - name: limit
|
||||
// type: integer
|
||||
// description: Number of statuses to return.
|
||||
// default: 30
|
||||
// in: query
|
||||
// required: false
|
||||
// - name: exclude_replies
|
||||
// type: boolean
|
||||
// description: Exclude statuses that are a reply to another status.
|
||||
// default: false
|
||||
// in: query
|
||||
// required: false
|
||||
// - name: exclude_reblogs
|
||||
// type: boolean
|
||||
// description: Exclude statuses that are a reblog/boost of another status.
|
||||
// default: false
|
||||
// in: query
|
||||
// required: false
|
||||
// - name: max_id
|
||||
// type: string
|
||||
// description: |-
|
||||
// Return only statuses *OLDER* than the given max status ID.
|
||||
// The status with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// - name: min_id
|
||||
// type: string
|
||||
// description: |-
|
||||
// Return only statuses *NEWER* than the given min status ID.
|
||||
// The status with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// required: false
|
||||
// - name: pinned_only
|
||||
// type: boolean
|
||||
// description: Show only pinned statuses. In other words, exclude statuses that are not pinned to the given account ID.
|
||||
// default: false
|
||||
// in: query
|
||||
// required: false
|
||||
// - name: only_media
|
||||
// type: boolean
|
||||
// description: Show only statuses with media attachments.
|
||||
// default: false
|
||||
// in: query
|
||||
// required: false
|
||||
// - name: only_public
|
||||
// type: boolean
|
||||
// description: Show only statuses with a privacy setting of 'public'.
|
||||
// default: false
|
||||
// in: query
|
||||
// required: false
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// type: string
|
||||
// description: Account ID.
|
||||
// in: path
|
||||
// required: true
|
||||
// -
|
||||
// name: limit
|
||||
// type: integer
|
||||
// description: Number of statuses to return.
|
||||
// default: 30
|
||||
// in: query
|
||||
// required: false
|
||||
// -
|
||||
// name: exclude_replies
|
||||
// type: boolean
|
||||
// description: Exclude statuses that are a reply to another status.
|
||||
// default: false
|
||||
// in: query
|
||||
// required: false
|
||||
// -
|
||||
// name: exclude_reblogs
|
||||
// type: boolean
|
||||
// description: Exclude statuses that are a reblog/boost of another status.
|
||||
// default: false
|
||||
// in: query
|
||||
// required: false
|
||||
// -
|
||||
// name: max_id
|
||||
// type: string
|
||||
// description: >-
|
||||
// Return only statuses *OLDER* than the given max status ID.
|
||||
// The status with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// -
|
||||
// name: min_id
|
||||
// type: string
|
||||
// description: >-
|
||||
// Return only statuses *NEWER* than the given min status ID.
|
||||
// The status with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// required: false
|
||||
// -
|
||||
// name: pinned_only
|
||||
// type: boolean
|
||||
// description: Show only pinned statuses. In other words, exclude statuses that are not pinned to the given account ID.
|
||||
// default: false
|
||||
// in: query
|
||||
// required: false
|
||||
// -
|
||||
// name: only_media
|
||||
// type: boolean
|
||||
// description: Show only statuses with media attachments.
|
||||
// default: false
|
||||
// in: query
|
||||
// required: false
|
||||
// -
|
||||
// name: only_public
|
||||
// type: boolean
|
||||
// description: Show only statuses with a privacy setting of 'public'.
|
||||
// default: false
|
||||
// in: query
|
||||
// required: false
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:accounts
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:accounts
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// name: statuses
|
||||
// description: Array of statuses.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/status"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// name: statuses
|
||||
// description: Array of statuses.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/status"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) AccountStatusesGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, false, false, false, false)
|
||||
if err != nil {
|
||||
|
@@ -32,40 +32,41 @@ import (
|
||||
//
|
||||
// Unblock account with ID.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// type: string
|
||||
// description: The id of the account to unblock.
|
||||
// in: path
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// type: string
|
||||
// description: The id of the account to unblock.
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:blocks
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:blocks
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// name: account relationship
|
||||
// description: Your relationship to this account.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/accountRelationship"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// name: account relationship
|
||||
// description: Your relationship to this account.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/accountRelationship"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) AccountUnblockPOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -32,40 +32,41 @@ import (
|
||||
//
|
||||
// Unfollow account with id.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
// ---
|
||||
// tags:
|
||||
// - accounts
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// type: string
|
||||
// description: The id of the account to unfollow.
|
||||
// in: path
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// type: string
|
||||
// description: The id of the account to unfollow.
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:follows
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:follows
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// name: account relationship
|
||||
// description: Your relationship to this account.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/accountRelationship"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// name: account relationship
|
||||
// description: Your relationship to this account.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/accountRelationship"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) AccountUnfollowPOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -34,52 +34,54 @@ import (
|
||||
//
|
||||
// Perform an admin action on an account.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - admin
|
||||
// ---
|
||||
// tags:
|
||||
// - admin
|
||||
//
|
||||
// consumes:
|
||||
// - multipart/form-data
|
||||
// consumes:
|
||||
// - multipart/form-data
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// required: true
|
||||
// in: path
|
||||
// description: ID of the account.
|
||||
// type: string
|
||||
// - name: type
|
||||
// in: formData
|
||||
// description: |-
|
||||
// Type of action to be taken. One of: disable, silence, suspend.
|
||||
// type: string
|
||||
// required: true
|
||||
// - name: text
|
||||
// in: formData
|
||||
// description: Optional text describing why this action was taken.
|
||||
// type: string
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// required: true
|
||||
// in: path
|
||||
// description: ID of the account.
|
||||
// type: string
|
||||
// -
|
||||
// name: type
|
||||
// in: formData
|
||||
// description: Type of action to be taken (`disable`, `silence`, or `suspend`).
|
||||
// type: string
|
||||
// required: true
|
||||
// -
|
||||
// name: text
|
||||
// in: formData
|
||||
// description: Optional text describing why this action was taken.
|
||||
// type: string
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: OK
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: OK
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) AccountActionPOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -35,87 +35,94 @@ import (
|
||||
//
|
||||
// Create one or more domain blocks, from a string or a file.
|
||||
//
|
||||
// Note that you have two options when using this endpoint: either you can set `import` to true
|
||||
// and upload a file containing multiple domain blocks, JSON-formatted, or you can leave import as
|
||||
// false, and just add one domain block.
|
||||
// You have two options when using this endpoint: either you can set `import` to `true` and
|
||||
// upload a file containing multiple domain blocks, JSON-formatted, or you can leave import as
|
||||
// `false`, and just add one domain block.
|
||||
//
|
||||
// The format of the json file should be something like: `[{"domain":"example.org"},{"domain":"whatever.com","public_comment":"they smell"}]`
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - admin
|
||||
// ---
|
||||
// tags:
|
||||
// - admin
|
||||
//
|
||||
// consumes:
|
||||
// - multipart/form-data
|
||||
// consumes:
|
||||
// - multipart/form-data
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: import
|
||||
// in: query
|
||||
// description: |-
|
||||
// Signal that a list of domain blocks is being imported as a file.
|
||||
// If set to true, then 'domains' must be present as a JSON-formatted file.
|
||||
// If set to false, then 'domains' will be ignored, and 'domain' must be present.
|
||||
// type: boolean
|
||||
// - name: domains
|
||||
// in: formData
|
||||
// description: |-
|
||||
// JSON-formatted list of domain blocks to import.
|
||||
// This is only used if `import` is set to true.
|
||||
// type: file
|
||||
// - name: domain
|
||||
// in: formData
|
||||
// description: |-
|
||||
// Single domain to block.
|
||||
// Used only if `import` is not true.
|
||||
// type: string
|
||||
// - name: obfuscate
|
||||
// in: formData
|
||||
// description: |-
|
||||
// Obfuscate the name of the domain when serving it publicly.
|
||||
// Eg., 'example.org' becomes something like 'ex***e.org'.
|
||||
// Used only if `import` is not true.
|
||||
// type: boolean
|
||||
// - name: public_comment
|
||||
// in: formData
|
||||
// description: |-
|
||||
// Public comment about this domain block.
|
||||
// Will be displayed alongside the domain block if you choose to share blocks.
|
||||
// Used only if `import` is not true.
|
||||
// type: string
|
||||
// - name: private_comment
|
||||
// in: formData
|
||||
// description: |-
|
||||
// Private comment about this domain block. Will only be shown to other admins, so this
|
||||
// is a useful way of internally keeping track of why a certain domain ended up blocked.
|
||||
// Used only if `import` is not true.
|
||||
// type: string
|
||||
// parameters:
|
||||
// -
|
||||
// name: import
|
||||
// in: query
|
||||
// description: >-
|
||||
// Signal that a list of domain blocks is being imported as a file.
|
||||
// If set to `true`, then 'domains' must be present as a JSON-formatted file.
|
||||
// If set to `false`, then `domains` will be ignored, and `domain` must be present.
|
||||
// type: boolean
|
||||
// default: false
|
||||
// -
|
||||
// name: domains
|
||||
// in: formData
|
||||
// description: >-
|
||||
// JSON-formatted list of domain blocks to import.
|
||||
// This is only used if `import` is set to `true`.
|
||||
// type: file
|
||||
// -
|
||||
// name: domain
|
||||
// in: formData
|
||||
// description: >-
|
||||
// Single domain to block.
|
||||
// Used only if `import` is not `true`.
|
||||
// type: string
|
||||
// -
|
||||
// name: obfuscate
|
||||
// in: formData
|
||||
// description: >-
|
||||
// Obfuscate the name of the domain when serving it publicly.
|
||||
// Eg., `example.org` becomes something like `ex***e.org`.
|
||||
// Used only if `import` is not `true`.
|
||||
// type: boolean
|
||||
// -
|
||||
// name: public_comment
|
||||
// in: formData
|
||||
// description: >-
|
||||
// Public comment about this domain block.
|
||||
// This will be displayed alongside the domain block if you choose to share blocks.
|
||||
// Used only if `import` is not `true`.
|
||||
// type: string
|
||||
// -
|
||||
// name: private_comment
|
||||
// in: formData
|
||||
// description: >-
|
||||
// Private comment about this domain block. Will only be shown to other admins, so this
|
||||
// is a useful way of internally keeping track of why a certain domain ended up blocked.
|
||||
// Used only if `import` is not `true`.
|
||||
// type: string
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: |-
|
||||
// The newly created domain block, if `import` != `true`.
|
||||
// Note that if a list has been imported, then an `array` of newly created domain blocks will be returned instead.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/domainBlock"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: >-
|
||||
// The newly created domain block, if `import` != `true`.
|
||||
// If a list has been imported, then an `array` of newly created domain blocks will be returned instead.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/domainBlock"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainBlocksPOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -33,41 +33,42 @@ import (
|
||||
//
|
||||
// Delete domain block with the given ID.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - admin
|
||||
// ---
|
||||
// tags:
|
||||
// - admin
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// type: string
|
||||
// description: The id of the domain block.
|
||||
// in: path
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// type: string
|
||||
// description: The id of the domain block.
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: The domain block that was just deleted.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/domainBlock"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: The domain block that was just deleted.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/domainBlock"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainBlockDELETEHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -34,41 +34,42 @@ import (
|
||||
//
|
||||
// View domain block with the given ID.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - admin
|
||||
// ---
|
||||
// tags:
|
||||
// - admin
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// type: string
|
||||
// description: The id of the domain block.
|
||||
// in: path
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// type: string
|
||||
// description: The id of the domain block.
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: The requested domain block.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/domainBlock"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: The requested domain block.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/domainBlock"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainBlockGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -33,47 +33,48 @@ import (
|
||||
//
|
||||
// View all domain blocks currently in place.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - admin
|
||||
// ---
|
||||
// tags:
|
||||
// - admin
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: export
|
||||
// type: boolean
|
||||
// description: |-
|
||||
// If set to true, then each entry in the returned list of domain blocks will only consist of
|
||||
// the fields 'domain' and 'public_comment'. This is perfect for when you want to save and share
|
||||
// a list of all the domains you have blocked on your instance, so that someone else can easily import them,
|
||||
// but you don't need them to see the database IDs of your blocks, or private comments etc.
|
||||
// in: query
|
||||
// required: false
|
||||
// parameters:
|
||||
// -
|
||||
// name: export
|
||||
// type: boolean
|
||||
// description: >-
|
||||
// If set to `true`, then each entry in the returned list of domain blocks will only consist of
|
||||
// the fields `domain` and `public_comment`. This is perfect for when you want to save and share
|
||||
// a list of all the domains you have blocked on your instance, so that someone else can easily import them,
|
||||
// but you don't want them to see the database IDs of your blocks, or private comments etc.
|
||||
// in: query
|
||||
// required: false
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: All domain blocks currently in place.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/domainBlock"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: All domain blocks currently in place.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/domainBlock"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainBlocksGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -36,56 +36,58 @@ import (
|
||||
//
|
||||
// Upload and create a new instance emoji.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - admin
|
||||
// ---
|
||||
// tags:
|
||||
// - admin
|
||||
//
|
||||
// consumes:
|
||||
// - multipart/form-data
|
||||
// consumes:
|
||||
// - multipart/form-data
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: shortcode
|
||||
// in: formData
|
||||
// description: |-
|
||||
// The code to use for the emoji, which will be used by instance denizens to select it.
|
||||
// This must be unique on the instance.
|
||||
// type: string
|
||||
// pattern: \w{2,30}
|
||||
// required: true
|
||||
// - name: image
|
||||
// in: formData
|
||||
// description: |-
|
||||
// A png or gif image of the emoji. Animated pngs work too!
|
||||
// To ensure compatibility with other fedi implementations, emoji size limit is 50kb by default.
|
||||
// type: file
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: shortcode
|
||||
// in: formData
|
||||
// description: >-
|
||||
// The code to use for the emoji, which will be used by instance denizens to select it.
|
||||
// This must be unique on the instance.
|
||||
// type: string
|
||||
// pattern: \w{2,30}
|
||||
// required: true
|
||||
// -
|
||||
// name: image
|
||||
// in: formData
|
||||
// description: >-
|
||||
// A png or gif image of the emoji. Animated pngs work too!
|
||||
// To ensure compatibility with other fedi implementations, emoji size limit is 50kb by default.
|
||||
// type: file
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: The newly-created emoji.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/emoji"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '409':
|
||||
// description: conflict -- domain/shortcode combo for emoji already exists
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: The newly-created emoji.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/emoji"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '409':
|
||||
// description: conflict -- shortcode for this emoji is already in use
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) EmojiCreatePOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -35,38 +35,39 @@ import (
|
||||
// Clean up remote media older than the specified number of days.
|
||||
// Also cleans up unused headers + avatars from the media cache.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - admin
|
||||
// ---
|
||||
// tags:
|
||||
// - admin
|
||||
//
|
||||
// consumes:
|
||||
// - application/json
|
||||
// - application/xml
|
||||
// - application/x-www-form-urlencoded
|
||||
// consumes:
|
||||
// - application/json
|
||||
// - application/xml
|
||||
// - application/x-www-form-urlencoded
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: |-
|
||||
// Echos the number of days requested. The cleanup is performed asynchronously after the request completes.
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: >-
|
||||
// Echos the number of days requested.
|
||||
// The cleanup is performed asynchronously after the request completes.
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) MediaCleanupPOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -45,35 +45,35 @@ const (
|
||||
// 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'.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - apps
|
||||
// ---
|
||||
// tags:
|
||||
// - apps
|
||||
//
|
||||
// consumes:
|
||||
// - application/json
|
||||
// - application/xml
|
||||
// - application/x-www-form-urlencoded
|
||||
// consumes:
|
||||
// - application/json
|
||||
// - application/xml
|
||||
// - application/x-www-form-urlencoded
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: "The newly-created application."
|
||||
// schema:
|
||||
// "$ref": "#/definitions/application"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: "The newly-created application."
|
||||
// schema:
|
||||
// "$ref": "#/definitions/application"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) AppsPOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, false, false, false, false)
|
||||
if err != nil {
|
||||
|
@@ -40,56 +40,59 @@ import (
|
||||
// <https://example.org/api/v1/blocks?limit=80&max_id=01FC0SKA48HNSVR6YKZCQGS2V8>; rel="next", <https://example.org/api/v1/blocks?limit=80&min_id=01FC0SKW5JK2Q4EVAV2B462YY0>; rel="prev"
|
||||
// ````
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - blocks
|
||||
// ---
|
||||
// tags:
|
||||
// - blocks
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: limit
|
||||
// type: integer
|
||||
// description: Number of blocks to return.
|
||||
// default: 20
|
||||
// in: query
|
||||
// - name: max_id
|
||||
// type: string
|
||||
// description: |-
|
||||
// Return only blocks *OLDER* than the given max block ID.
|
||||
// The block with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// - name: since_id
|
||||
// type: string
|
||||
// description: |-
|
||||
// Return only blocks *NEWER* than the given since block ID.
|
||||
// The block with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// parameters:
|
||||
// -
|
||||
// name: limit
|
||||
// type: integer
|
||||
// description: Number of blocks to return.
|
||||
// default: 20
|
||||
// in: query
|
||||
// -
|
||||
// name: max_id
|
||||
// type: string
|
||||
// description: >-
|
||||
// Return only blocks *OLDER* than the given block ID.
|
||||
// The block with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// -
|
||||
// name: since_id
|
||||
// type: string
|
||||
// description: >-
|
||||
// Return only blocks *NEWER* than the given block ID.
|
||||
// The block with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:blocks
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:blocks
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// headers:
|
||||
// Link:
|
||||
// type: string
|
||||
// description: Links to the next and previous queries.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/account"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// headers:
|
||||
// Link:
|
||||
// type: string
|
||||
// description: Links to the next and previous queries.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/account"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) BlocksGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -13,30 +13,30 @@ import (
|
||||
//
|
||||
// Get an array of custom emojis available on the instance.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - custom_emojis
|
||||
// ---
|
||||
// tags:
|
||||
// - custom_emojis
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:custom_emojis
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:custom_emojis
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: Array of custom emojis.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/emoji"
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: Array of custom emojis.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/emoji"
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) EmojisGETHandler(c *gin.Context) {
|
||||
if _, err := oauth.Authed(c, true, true, true, true); err != nil {
|
||||
api.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGet)
|
||||
|
@@ -11,7 +11,70 @@ import (
|
||||
"github.com/superseriousbusiness/gotosocial/internal/oauth"
|
||||
)
|
||||
|
||||
// FavouritesGETHandler handles GETting favourites.
|
||||
// FavouritesGETHandler swagger:operation GET /api/v1/favourites favouritesGet
|
||||
//
|
||||
// Get an array of statuses that the requesting account has favourited.
|
||||
//
|
||||
// The next and previous queries can be parsed from the returned Link header.
|
||||
// Example:
|
||||
//
|
||||
// ```
|
||||
// <https://example.org/api/v1/favourites?limit=80&max_id=01FC0SKA48HNSVR6YKZCQGS2V8>; rel="next", <https://example.org/api/v1/favourites?limit=80&min_id=01FC0SKW5JK2Q4EVAV2B462YY0>; rel="prev"
|
||||
// ````
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - favourites
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// -
|
||||
// name: limit
|
||||
// type: integer
|
||||
// description: Number of statuses to return.
|
||||
// default: 20
|
||||
// in: query
|
||||
// -
|
||||
// name: max_id
|
||||
// type: string
|
||||
// description: >-
|
||||
// Return only favourited statuses *OLDER* than the given favourite ID.
|
||||
// The status with the corresponding fave ID will not be included in the response.
|
||||
// in: query
|
||||
// -
|
||||
// name: min_id
|
||||
// type: string
|
||||
// description: >-
|
||||
// Return only favourited statuses *NEWER* than the given favourite ID.
|
||||
// The status with the corresponding fave ID will not be included in the response.
|
||||
// in: query
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:favourites
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// headers:
|
||||
// Link:
|
||||
// type: string
|
||||
// description: Links to the next and previous queries.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/status"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) FavouritesGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -34,40 +34,41 @@ import (
|
||||
//
|
||||
// Accept a follow request and put the requesting account in your 'followers' list.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - follow_requests
|
||||
// ---
|
||||
// tags:
|
||||
// - follow_requests
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: account_id
|
||||
// type: string
|
||||
// description: ID of the account requesting to follow you.
|
||||
// in: path
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: account_id
|
||||
// type: string
|
||||
// description: ID of the account requesting to follow you.
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:follows
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:follows
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// name: account relationship
|
||||
// description: Your relationship to this account.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/accountRelationship"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// name: account relationship
|
||||
// description: Your relationship to this account.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/accountRelationship"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) FollowRequestAuthorizePOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -88,6 +88,8 @@ func (suite *FollowRequestStandardTestSuite) SetupTest() {
|
||||
suite.followRequestModule = followrequest.New(suite.processor).(*followrequest.Module)
|
||||
testrig.StandardDBSetup(suite.db, nil)
|
||||
testrig.StandardStorageSetup(suite.storage, "../../../../testrig/media")
|
||||
|
||||
suite.NoError(suite.processor.Start())
|
||||
}
|
||||
|
||||
func (suite *FollowRequestStandardTestSuite) TearDownTest() {
|
||||
|
@@ -30,52 +30,47 @@ import (
|
||||
// FollowRequestGETHandler swagger:operation GET /api/v1/follow_requests getFollowRequests
|
||||
//
|
||||
// Get an array of accounts that have requested to follow you.
|
||||
// Accounts will be sorted in order of follow request date descending (newest first).
|
||||
//
|
||||
// The next and previous queries can be parsed from the returned Link header.
|
||||
// Example:
|
||||
// ---
|
||||
// tags:
|
||||
// - follow_requests
|
||||
//
|
||||
// ```
|
||||
// <https://example.org/api/v1/follow_requests?limit=80&max_id=01FC0SKA48HNSVR6YKZCQGS2V8>; rel="next", <https://example.org/api/v1/follow_requests?limit=80&min_id=01FC0SKW5JK2Q4EVAV2B462YY0>; rel="prev"
|
||||
// ````
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - follow_requests
|
||||
// parameters:
|
||||
// -
|
||||
// name: limit
|
||||
// type: integer
|
||||
// description: Number of accounts to return.
|
||||
// default: 40
|
||||
// in: query
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:follows
|
||||
//
|
||||
// parameters:
|
||||
// - name: limit
|
||||
// type: integer
|
||||
// description: Number of accounts to return.
|
||||
// default: 40
|
||||
// in: query
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:follows
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// headers:
|
||||
// Link:
|
||||
// type: string
|
||||
// description: Links to the next and previous queries.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/account"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// headers:
|
||||
// Link:
|
||||
// type: string
|
||||
// description: Links to the next and previous queries.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/account"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) FollowRequestGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -32,40 +32,41 @@ import (
|
||||
//
|
||||
// Reject/deny follow request from the given account ID.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - follow_requests
|
||||
// ---
|
||||
// tags:
|
||||
// - follow_requests
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: account_id
|
||||
// type: string
|
||||
// description: ID of the account requesting to follow you.
|
||||
// in: path
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: account_id
|
||||
// type: string
|
||||
// description: ID of the account requesting to follow you.
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:follows
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:follows
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// name: account relationship
|
||||
// description: Your relationship to this account.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/accountRelationship"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// name: account relationship
|
||||
// description: Your relationship to this account.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/accountRelationship"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) FollowRequestRejectPOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -32,26 +32,22 @@ import (
|
||||
//
|
||||
// View instance information.
|
||||
//
|
||||
// This is mostly provided for Mastodon application compatibility, since many apps that work with Mastodon use `/api/v1/instance` to inform their connection parameters.
|
||||
// ---
|
||||
// tags:
|
||||
// - instance
|
||||
//
|
||||
// However, it can also be used by other instances for gathering instance information and representing instances in some UI or other.
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - instance
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: "Instance information."
|
||||
// schema:
|
||||
// "$ref": "#/definitions/instance"
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: "Instance information."
|
||||
// schema:
|
||||
// "$ref": "#/definitions/instance"
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal error
|
||||
func (m *Module) InstanceInformationGETHandler(c *gin.Context) {
|
||||
if _, err := api.NegotiateAccept(c, api.JSONAcceptHeaders...); err != nil {
|
||||
api.ErrorHandler(c, gtserror.NewErrorNotAcceptable(err, err.Error()), m.processor.InstanceGet)
|
||||
|
@@ -35,83 +35,91 @@ import (
|
||||
//
|
||||
// This requires admin permissions on the instance.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - instance
|
||||
// ---
|
||||
// tags:
|
||||
// - instance
|
||||
//
|
||||
// consumes:
|
||||
// - multipart/form-data
|
||||
// consumes:
|
||||
// - multipart/form-data
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: title
|
||||
// in: formData
|
||||
// description: Title to use for the instance.
|
||||
// type: string
|
||||
// maximum: 40
|
||||
// allowEmptyValue: true
|
||||
// - name: contact_username
|
||||
// in: formData
|
||||
// description: |-
|
||||
// Username of the contact account.
|
||||
// This must be the username of an instance admin.
|
||||
// type: string
|
||||
// allowEmptyValue: true
|
||||
// - name: contact_email
|
||||
// in: formData
|
||||
// description: Email address to use as the instance contact.
|
||||
// type: string
|
||||
// allowEmptyValue: true
|
||||
// - name: short_description
|
||||
// in: formData
|
||||
// description: Short description of the instance.
|
||||
// type: string
|
||||
// maximum: 500
|
||||
// allowEmptyValue: true
|
||||
// - name: description
|
||||
// in: formData
|
||||
// description: Longer description of the instance.
|
||||
// type: string
|
||||
// maximum: 5000
|
||||
// allowEmptyValue: true
|
||||
// - name: terms
|
||||
// in: formData
|
||||
// description: Terms and conditions of the instance.
|
||||
// type: string
|
||||
// maximum: 5000
|
||||
// allowEmptyValue: true
|
||||
// - name: avatar
|
||||
// in: formData
|
||||
// description: Avatar of the instance.
|
||||
// type: file
|
||||
// - name: header
|
||||
// in: formData
|
||||
// description: Header of the instance.
|
||||
// type: file
|
||||
// parameters:
|
||||
// -
|
||||
// name: title
|
||||
// in: formData
|
||||
// description: Title to use for the instance.
|
||||
// type: string
|
||||
// maximum: 40
|
||||
// allowEmptyValue: true
|
||||
// -
|
||||
// name: contact_username
|
||||
// in: formData
|
||||
// description: >-
|
||||
// Username of the contact account.
|
||||
// This must be the username of an instance admin.
|
||||
// type: string
|
||||
// allowEmptyValue: true
|
||||
// -
|
||||
// name: contact_email
|
||||
// in: formData
|
||||
// description: Email address to use as the instance contact.
|
||||
// type: string
|
||||
// allowEmptyValue: true
|
||||
// -
|
||||
// name: short_description
|
||||
// in: formData
|
||||
// description: Short description of the instance.
|
||||
// type: string
|
||||
// maximum: 500
|
||||
// allowEmptyValue: true
|
||||
// -
|
||||
// name: description
|
||||
// in: formData
|
||||
// description: Longer description of the instance.
|
||||
// type: string
|
||||
// maximum: 5000
|
||||
// allowEmptyValue: true
|
||||
// -
|
||||
// name: terms
|
||||
// in: formData
|
||||
// description: Terms and conditions of the instance.
|
||||
// type: string
|
||||
// maximum: 5000
|
||||
// allowEmptyValue: true
|
||||
// -
|
||||
// name: avatar
|
||||
// in: formData
|
||||
// description: Avatar of the instance.
|
||||
// type: file
|
||||
// -
|
||||
// name: header
|
||||
// in: formData
|
||||
// description: Header of the instance.
|
||||
// type: file
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: "The newly updated instance."
|
||||
// schema:
|
||||
// "$ref": "#/definitions/instance"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: "The newly updated instance."
|
||||
// schema:
|
||||
// "$ref": "#/definitions/instance"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) InstanceUpdatePATCHHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -32,62 +32,72 @@ import (
|
||||
|
||||
// InstancePeersGETHandler swagger:operation GET /api/v1/instance/peers instancePeersGet
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - instance
|
||||
// ---
|
||||
// tags:
|
||||
// - instance
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: filter
|
||||
// type: string
|
||||
// description: |-
|
||||
// Comma-separated list of filters to apply to results. Recognized values are:
|
||||
// 'open' -- include peers that are not suspended or silenced
|
||||
// 'suspended' -- include peers that have been suspended.
|
||||
// If filter is 'open', only instances that haven't been suspended or silenced will be returned.
|
||||
// If filter is 'suspended', only suspended instances will be shown.
|
||||
// If filter is 'open,suspended', then all known instances will be returned.
|
||||
// If filter is an empty string or not set, then 'open' will be assumed as the default.
|
||||
// in: query
|
||||
// required: false
|
||||
// parameters:
|
||||
// -
|
||||
// name: filter
|
||||
// type: string
|
||||
// description: |-
|
||||
// Comma-separated list of filters to apply to results. Recognized filters are:
|
||||
// - `open` -- include peers that are not suspended or silenced
|
||||
// - `suspended` -- include peers that have been suspended.
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: |-
|
||||
// If no filter parameter is provided, or filter is empty, then a legacy,
|
||||
// Mastodon-API compatible response will be returned. This will consist of
|
||||
// just a 'flat' array of strings like `["example.com", "example.org"]`.
|
||||
// If filter is `open`, only instances that haven't been suspended or silenced will be returned.
|
||||
//
|
||||
// If a filter parameter is provided, then an array of objects with at least
|
||||
// a `domain` key set on each object will be returned.
|
||||
// If filter is `suspended`, only suspended instances will be shown.
|
||||
//
|
||||
// Domains that are silenced or suspended will also have a key
|
||||
// 'suspended_at' or 'silenced_at' that contains an iso8601 date string.
|
||||
// If one of these keys is not present on the domain object, it is open.
|
||||
// Suspended instances may in some cases be obfuscated, which means they
|
||||
// will have some letters replaced by '*' to make it more difficult for
|
||||
// bad actors to target instances with harassment.
|
||||
// If filter is `open,suspended`, then all known instances will be returned.
|
||||
//
|
||||
// Whether a flat response or a more detailed response is returned, domains
|
||||
// will be sorted alphabetically by hostname.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/domain"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// If filter is an empty string or not set, then `open` will be assumed as the default.
|
||||
// in: query
|
||||
// required: false
|
||||
// default: "open"
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: >-
|
||||
// If no filter parameter is provided, or filter is empty, then a legacy,
|
||||
// Mastodon-API compatible response will be returned. This will consist of
|
||||
// just a 'flat' array of strings like `["example.com", "example.org"]`,
|
||||
// which corresponds to domains this instance peers with.
|
||||
//
|
||||
//
|
||||
// If a filter parameter is provided, then an array of objects with at least
|
||||
// a `domain` key set on each object will be returned.
|
||||
//
|
||||
//
|
||||
// Domains that are silenced or suspended will also have a key
|
||||
// `suspended_at` or `silenced_at` that contains an iso8601 date string.
|
||||
// If one of these keys is not present on the domain object, it is open.
|
||||
// Suspended instances may in some cases be obfuscated, which means they
|
||||
// will have some letters replaced by `*` to make it more difficult for
|
||||
// bad actors to target instances with harassment.
|
||||
//
|
||||
//
|
||||
// Whether a flat response or a more detailed response is returned, domains
|
||||
// will be sorted alphabetically by hostname.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/domain"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) InstancePeersGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, false, false, false, false)
|
||||
if err != nil {
|
||||
|
@@ -35,59 +35,64 @@ import (
|
||||
//
|
||||
// Upload a new media attachment.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - media
|
||||
// ---
|
||||
// tags:
|
||||
// - media
|
||||
//
|
||||
// consumes:
|
||||
// - multipart/form-data
|
||||
// consumes:
|
||||
// - multipart/form-data
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: api version
|
||||
// type: string
|
||||
// in: path
|
||||
// description: Version of the API to use. Must be one of v1 or v2.
|
||||
// required: true
|
||||
// - name: description
|
||||
// in: formData
|
||||
// description: |-
|
||||
// Image or media description to use as alt-text on the attachment.
|
||||
// This is very useful for users of screenreaders.
|
||||
// May or may not be required, depending on your instance settings.
|
||||
// type: string
|
||||
// - name: focus
|
||||
// in: formData
|
||||
// description: |-
|
||||
// Focus of the media file.
|
||||
// If present, it should be in the form of two comma-separated floats between -1 and 1.
|
||||
// For example: `-0.5,0.25`.
|
||||
// type: string
|
||||
// - name: file
|
||||
// in: formData
|
||||
// description: The media attachment to upload.
|
||||
// type: file
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: api_version
|
||||
// type: string
|
||||
// in: path
|
||||
// description: Version of the API to use. Must be either `v1` or `v2`.
|
||||
// required: true
|
||||
// -
|
||||
// name: description
|
||||
// in: formData
|
||||
// description: >-
|
||||
// Image or media description to use as alt-text on the attachment.
|
||||
// This is very useful for users of screenreaders!
|
||||
// May or may not be required, depending on your instance settings.
|
||||
// type: string
|
||||
// -
|
||||
// name: focus
|
||||
// in: formData
|
||||
// description: >-
|
||||
// Focus of the media file.
|
||||
// If present, it should be in the form of two comma-separated floats between -1 and 1.
|
||||
// For example: `-0.5,0.25`.
|
||||
// type: string
|
||||
// default: "0,0"
|
||||
// -
|
||||
// name: file
|
||||
// in: formData
|
||||
// description: The media attachment to upload.
|
||||
// type: file
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:media
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:media
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: The newly-created media attachment.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/attachment"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '422':
|
||||
// description: unprocessable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: The newly-created media attachment.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/attachment"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '422':
|
||||
// description: unprocessable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) MediaCreatePOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -32,39 +32,40 @@ import (
|
||||
//
|
||||
// Get a media attachment that you own.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - media
|
||||
// ---
|
||||
// tags:
|
||||
// - media
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// description: id of the attachment
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// description: id of the attachment
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:media
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:media
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: The requested media attachment.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/attachment"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: The requested media attachment.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/attachment"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) MediaGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -40,60 +40,64 @@ import (
|
||||
// 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'.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - media
|
||||
// ---
|
||||
// tags:
|
||||
// - media
|
||||
//
|
||||
// consumes:
|
||||
// - application/json
|
||||
// - application/xml
|
||||
// - application/x-www-form-urlencoded
|
||||
// consumes:
|
||||
// - application/json
|
||||
// - application/xml
|
||||
// - application/x-www-form-urlencoded
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// description: id of the attachment to update
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
// - name: description
|
||||
// in: formData
|
||||
// description: |-
|
||||
// Image or media description to use as alt-text on the attachment.
|
||||
// This is very useful for users of screenreaders.
|
||||
// May or may not be required, depending on your instance settings.
|
||||
// type: string
|
||||
// allowEmptyValue: true
|
||||
// - name: focus
|
||||
// in: formData
|
||||
// description: |-
|
||||
// Focus of the media file.
|
||||
// If present, it should be in the form of two comma-separated floats between -1 and 1.
|
||||
// For example: `-0.5,0.25`.
|
||||
// type: string
|
||||
// allowEmptyValue: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// description: id of the attachment to update
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
// -
|
||||
// name: description
|
||||
// in: formData
|
||||
// description: >-
|
||||
// Image or media description to use as alt-text on the attachment.
|
||||
// This is very useful for users of screenreaders!
|
||||
// May or may not be required, depending on your instance settings.
|
||||
// type: string
|
||||
// allowEmptyValue: true
|
||||
// -
|
||||
// name: focus
|
||||
// in: formData
|
||||
// description: >-
|
||||
// Focus of the media file.
|
||||
// If present, it should be in the form of two comma-separated floats between -1 and 1.
|
||||
// For example: `-0.5,0.25`.
|
||||
// type: string
|
||||
// allowEmptyValue: true
|
||||
// default: "0,0"
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:media
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:media
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: The newly-updated media attachment.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/attachment"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: The newly-updated media attachment.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/attachment"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) MediaPUTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -27,7 +27,37 @@ import (
|
||||
"github.com/superseriousbusiness/gotosocial/internal/oauth"
|
||||
)
|
||||
|
||||
// NotificationsClearPOSTHandler clears all the notifications
|
||||
// NotificationsClearPOSTHandler swagger:operation POST /api/v1/notifications clearNotifications
|
||||
//
|
||||
// Clear/delete all notifications for currently authorized user.
|
||||
//
|
||||
// Will return an empty object `{}` to indicate success.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - notifications
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:notifications
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// schema:
|
||||
// type: object
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) NotificationsClearPOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -35,64 +35,79 @@ import (
|
||||
//
|
||||
// The notifications will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer).
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - notifications
|
||||
// The next and previous queries can be parsed from the returned Link header.
|
||||
// Example:
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// ```
|
||||
// <https://example.org/api/v1/notifications?limit=80&max_id=01FC0SKA48HNSVR6YKZCQGS2V8>; rel="next", <https://example.org/api/v1/notifications?limit=80&since_id=01FC0SKW5JK2Q4EVAV2B462YY0>; rel="prev"
|
||||
// ````
|
||||
//
|
||||
// parameters:
|
||||
// - name: limit
|
||||
// type: integer
|
||||
// description: Number of notifications to return.
|
||||
// default: 20
|
||||
// in: query
|
||||
// required: false
|
||||
// - name: exclude_types
|
||||
// type: array
|
||||
// items:
|
||||
// type: string
|
||||
// description: Array of types of notifications to exclude (follow, favourite, reblog, mention, poll, follow_request)
|
||||
// in: query
|
||||
// required: false
|
||||
// - name: max_id
|
||||
// type: string
|
||||
// description: |-
|
||||
// Return only notifications *OLDER* than the given max status ID.
|
||||
// The status with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// required: false
|
||||
// - name: since_id
|
||||
// type: string
|
||||
// description: |-
|
||||
// Return only notifications *NEWER* than the given since status ID.
|
||||
// The status with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// required: false
|
||||
// ---
|
||||
// tags:
|
||||
// - notifications
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:notifications
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// name: notifications
|
||||
// description: Array of notifications.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/notification"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// parameters:
|
||||
// -
|
||||
// name: limit
|
||||
// type: integer
|
||||
// description: Number of notifications to return.
|
||||
// default: 20
|
||||
// in: query
|
||||
// required: false
|
||||
// -
|
||||
// name: exclude_types
|
||||
// type: array
|
||||
// items:
|
||||
// type: string
|
||||
// description: Array of types of notifications to exclude (follow, favourite, reblog, mention, poll, follow_request)
|
||||
// in: query
|
||||
// required: false
|
||||
// -
|
||||
// name: max_id
|
||||
// type: string
|
||||
// description: >-
|
||||
// Return only notifications *OLDER* than the given max status ID.
|
||||
// The status with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// required: false
|
||||
// -
|
||||
// name: since_id
|
||||
// type: string
|
||||
// description: |-
|
||||
// Return only notifications *NEWER* than the given since status ID.
|
||||
// The status with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// required: false
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:notifications
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// headers:
|
||||
// Link:
|
||||
// type: string
|
||||
// description: Links to the next and previous queries.
|
||||
// name: notifications
|
||||
// description: Array of notifications.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/notification"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) NotificationsGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -37,32 +37,32 @@ import (
|
||||
//
|
||||
// If statuses are in the result, they will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer).
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - search
|
||||
// ---
|
||||
// tags:
|
||||
// - search
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:search
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:search
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// name: search results
|
||||
// description: Results of the search.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/searchResult"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// name: search results
|
||||
// description: Results of the search.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/searchResult"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) SearchGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -88,6 +88,8 @@ func (suite *StatusStandardTestSuite) SetupTest() {
|
||||
suite.emailSender = testrig.NewEmailSender("../../../../web/template/", nil)
|
||||
suite.processor = testrig.NewTestProcessor(suite.db, suite.storage, suite.federator, suite.emailSender, suite.mediaManager, clientWorker, fedWorker)
|
||||
suite.statusModule = status.New(suite.processor).(*status.Module)
|
||||
|
||||
suite.NoError(suite.processor.Start())
|
||||
}
|
||||
|
||||
func (suite *StatusStandardTestSuite) TearDownTest() {
|
||||
|
@@ -33,44 +33,45 @@ import (
|
||||
// Reblog/boost status with the given ID.
|
||||
//
|
||||
// If the target status is rebloggable/boostable, it will be shared with your followers.
|
||||
// This is equivalent to an activitypub 'announce' activity.
|
||||
// This is equivalent to an ActivityPub 'Announce' activity.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - statuses
|
||||
// ---
|
||||
// tags:
|
||||
// - statuses
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// type: string
|
||||
// description: Target status ID.
|
||||
// in: path
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// type: string
|
||||
// description: Target status ID.
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:statuses
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:statuses
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// name: status
|
||||
// description: The boost of the status.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/status"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// name: status
|
||||
// description: The boost of the status.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/status"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) StatusBoostPOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -32,38 +32,39 @@ import (
|
||||
//
|
||||
// View accounts that have reblogged/boosted the target status.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - statuses
|
||||
// ---
|
||||
// tags:
|
||||
// - statuses
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// type: string
|
||||
// description: Target status ID.
|
||||
// in: path
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// type: string
|
||||
// description: Target status ID.
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:accounts
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:accounts
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/account"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// responses:
|
||||
// '200':
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/account"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
func (m *Module) StatusBoostedByGETHandler(c *gin.Context) {
|
||||
l := log.WithFields(kv.Fields{
|
||||
|
||||
|
@@ -34,42 +34,43 @@ import (
|
||||
//
|
||||
// The returned statuses will be ordered in a thread structure, so they are suitable to be displayed in the order in which they were returned.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - statuses
|
||||
// ---
|
||||
// tags:
|
||||
// - statuses
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// type: string
|
||||
// description: Target status ID.
|
||||
// in: path
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// type: string
|
||||
// description: Target status ID.
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:statuses
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:statuses
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// name: statuses
|
||||
// description: Status context object.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/statusContext"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// name: statuses
|
||||
// description: Status context object.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/statusContext"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) StatusContextGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -39,39 +39,39 @@ import (
|
||||
// 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'.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - statuses
|
||||
// ---
|
||||
// tags:
|
||||
// - statuses
|
||||
//
|
||||
// consumes:
|
||||
// - application/json
|
||||
// - application/xml
|
||||
// - application/x-www-form-urlencoded
|
||||
// consumes:
|
||||
// - application/json
|
||||
// - application/xml
|
||||
// - application/x-www-form-urlencoded
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:statuses
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:statuses
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: "The newly created status."
|
||||
// schema:
|
||||
// "$ref": "#/definitions/status"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: "The newly created status."
|
||||
// schema:
|
||||
// "$ref": "#/definitions/status"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) StatusCreatePOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -35,41 +35,42 @@ import (
|
||||
// The deleted status will be returned in the response. The `text` field will contain the original text of the status as it was submitted.
|
||||
// This is useful when doing a 'delete and redraft' type operation.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - statuses
|
||||
// ---
|
||||
// tags:
|
||||
// - statuses
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// type: string
|
||||
// description: Target status ID.
|
||||
// in: path
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// type: string
|
||||
// description: Target status ID.
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:statuses
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:statuses
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: "The newly deleted status."
|
||||
// schema:
|
||||
// "$ref": "#/definitions/status"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: "The status that was just deleted."
|
||||
// schema:
|
||||
// "$ref": "#/definitions/status"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) StatusDELETEHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -32,41 +32,42 @@ import (
|
||||
//
|
||||
// Star/like/favourite the given status, if permitted.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - statuses
|
||||
// ---
|
||||
// tags:
|
||||
// - statuses
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// type: string
|
||||
// description: Target status ID.
|
||||
// in: path
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// type: string
|
||||
// description: Target status ID.
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:statuses
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:statuses
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: "The newly faved status."
|
||||
// schema:
|
||||
// "$ref": "#/definitions/status"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: "The newly faved status."
|
||||
// schema:
|
||||
// "$ref": "#/definitions/status"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) StatusFavePOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -32,42 +32,43 @@ import (
|
||||
//
|
||||
// View accounts that have faved/starred/liked the target status.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - statuses
|
||||
// ---
|
||||
// tags:
|
||||
// - statuses
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// type: string
|
||||
// description: Target status ID.
|
||||
// in: path
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// type: string
|
||||
// description: Target status ID.
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:accounts
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:accounts
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/account"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/account"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) StatusFavedByGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -32,41 +32,42 @@ import (
|
||||
//
|
||||
// View status with the given ID.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - statuses
|
||||
// ---
|
||||
// tags:
|
||||
// - statuses
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// type: string
|
||||
// description: Target status ID.
|
||||
// in: path
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// type: string
|
||||
// description: Target status ID.
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:statuses
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:statuses
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: "The requested created status."
|
||||
// schema:
|
||||
// "$ref": "#/definitions/status"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: "The requested status."
|
||||
// schema:
|
||||
// "$ref": "#/definitions/status"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) StatusGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -32,42 +32,43 @@ import (
|
||||
//
|
||||
// Unreblog/unboost status with the given ID.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - statuses
|
||||
// ---
|
||||
// tags:
|
||||
// - statuses
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// type: string
|
||||
// description: Target status ID.
|
||||
// in: path
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// type: string
|
||||
// description: Target status ID.
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:statuses
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:statuses
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// name: status
|
||||
// description: The unboosted status.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/status"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// name: status
|
||||
// description: The unboosted status.
|
||||
// schema:
|
||||
// "$ref": "#/definitions/status"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) StatusUnboostPOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -32,41 +32,42 @@ import (
|
||||
//
|
||||
// Unstar/unlike/unfavourite the given status.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - statuses
|
||||
// ---
|
||||
// tags:
|
||||
// - statuses
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: id
|
||||
// type: string
|
||||
// description: Target status ID.
|
||||
// in: path
|
||||
// required: true
|
||||
// parameters:
|
||||
// -
|
||||
// name: id
|
||||
// type: string
|
||||
// description: Target status ID.
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:statuses
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:statuses
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: "The unfaved status."
|
||||
// schema:
|
||||
// "$ref": "#/definitions/status"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: "The unfaved status."
|
||||
// schema:
|
||||
// "$ref": "#/definitions/status"
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '404':
|
||||
// description: not found
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) StatusUnfavePOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -35,89 +35,92 @@ var wsUpgrader = websocket.Upgrader{
|
||||
//
|
||||
// If the ping fails, or something else goes wrong during transmission, then the connection will be dropped, and the client will be expected to start it again.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - streaming
|
||||
// ---
|
||||
// tags:
|
||||
// - streaming
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// schemes:
|
||||
// - wss
|
||||
// schemes:
|
||||
// - wss
|
||||
//
|
||||
// parameters:
|
||||
// - name: access_token
|
||||
// type: string
|
||||
// description: Access token for the requesting account.
|
||||
// in: query
|
||||
// required: true
|
||||
// - name: stream
|
||||
// type: string
|
||||
// description: |-
|
||||
// Type of stream to request.
|
||||
// parameters:
|
||||
// -
|
||||
// name: access_token
|
||||
// type: string
|
||||
// description: Access token for the requesting account.
|
||||
// in: query
|
||||
// required: true
|
||||
// -
|
||||
// name: stream
|
||||
// type: string
|
||||
// description: |-
|
||||
// Type of stream to request.
|
||||
//
|
||||
// Options are:
|
||||
// Options are:
|
||||
//
|
||||
// `user`: receive updates for the account's home timeline.
|
||||
// `public`: receive updates for the public timeline.
|
||||
// `public:local`: receive updates for the local timeline.
|
||||
// `hashtag`: receive updates for a given hashtag.
|
||||
// `hashtag:local`: receive local updates for a given hashtag.
|
||||
// `list`: receive updates for a certain list of accounts.
|
||||
// `direct`: receive updates for direct messages.
|
||||
// in: query
|
||||
// required: true
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:streaming
|
||||
// `user`: receive updates for the account's home timeline.
|
||||
// `public`: receive updates for the public timeline.
|
||||
// `public:local`: receive updates for the local timeline.
|
||||
// `hashtag`: receive updates for a given hashtag.
|
||||
// `hashtag:local`: receive local updates for a given hashtag.
|
||||
// `list`: receive updates for a certain list of accounts.
|
||||
// `direct`: receive updates for direct messages.
|
||||
// in: query
|
||||
// required: true
|
||||
//
|
||||
// responses:
|
||||
// '101':
|
||||
// schema:
|
||||
// type: object
|
||||
// properties:
|
||||
// stream:
|
||||
// type: array
|
||||
// items:
|
||||
// type: string
|
||||
// enum:
|
||||
// - user
|
||||
// - public
|
||||
// - public:local
|
||||
// - hashtag
|
||||
// - hashtag:local
|
||||
// - list
|
||||
// - direct
|
||||
// event:
|
||||
// description: |-
|
||||
// The type of event being received.
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:streaming
|
||||
//
|
||||
// `update`: a new status has been received.
|
||||
// `notification`: a new notification has been received.
|
||||
// `delete`: a status has been deleted.
|
||||
// `filters_changed`: not implemented.
|
||||
// type: string
|
||||
// enum:
|
||||
// - update
|
||||
// - notification
|
||||
// - delete
|
||||
// - filters_changed
|
||||
// payload:
|
||||
// description: |-
|
||||
// The payload of the streamed message.
|
||||
// Different depending on the `event` type.
|
||||
// responses:
|
||||
// '101':
|
||||
// schema:
|
||||
// type: object
|
||||
// properties:
|
||||
// stream:
|
||||
// type: array
|
||||
// items:
|
||||
// type: string
|
||||
// enum:
|
||||
// - user
|
||||
// - public
|
||||
// - public:local
|
||||
// - hashtag
|
||||
// - hashtag:local
|
||||
// - list
|
||||
// - direct
|
||||
// event:
|
||||
// description: |-
|
||||
// The type of event being received.
|
||||
//
|
||||
// If present, it should be parsed as a string.
|
||||
// `update`: a new status has been received.
|
||||
// `notification`: a new notification has been received.
|
||||
// `delete`: a status has been deleted.
|
||||
// `filters_changed`: not implemented.
|
||||
// type: string
|
||||
// enum:
|
||||
// - update
|
||||
// - notification
|
||||
// - delete
|
||||
// - filters_changed
|
||||
// payload:
|
||||
// description: |-
|
||||
// The payload of the streamed message.
|
||||
// Different depending on the `event` type.
|
||||
//
|
||||
// If `event` = `update`, then the payload will be a JSON string of a status.
|
||||
// If `event` = `notification`, then the payload will be a JSON string of a notification.
|
||||
// If `event` = `delete`, then the payload will be a status ID.
|
||||
// type: string
|
||||
// example: "{\"id\":\"01FC3TZ5CFG6H65GCKCJRKA669\",\"created_at\":\"2021-08-02T16:25:52Z\",\"sensitive\":false,\"spoiler_text\":\"\",\"visibility\":\"public\",\"language\":\"en\",\"uri\":\"https://gts.superseriousbusiness.org/users/dumpsterqueer/statuses/01FC3TZ5CFG6H65GCKCJRKA669\",\"url\":\"https://gts.superseriousbusiness.org/@dumpsterqueer/statuses/01FC3TZ5CFG6H65GCKCJRKA669\",\"replies_count\":0,\"reblogs_count\":0,\"favourites_count\":0,\"favourited\":false,\"reblogged\":false,\"muted\":false,\"bookmarked\":fals…//gts.superseriousbusiness.org/fileserver/01JNN207W98SGG3CBJ76R5MVDN/header/original/019036W043D8FXPJKSKCX7G965.png\",\"header_static\":\"https://gts.superseriousbusiness.org/fileserver/01JNN207W98SGG3CBJ76R5MVDN/header/small/019036W043D8FXPJKSKCX7G965.png\",\"followers_count\":33,\"following_count\":28,\"statuses_count\":126,\"last_status_at\":\"2021-08-02T16:25:52Z\",\"emojis\":[],\"fields\":[]},\"media_attachments\":[],\"mentions\":[],\"tags\":[],\"emojis\":[],\"card\":null,\"poll\":null,\"text\":\"a\"}"
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '400':
|
||||
// description: bad request
|
||||
// If present, it should be parsed as a string.
|
||||
//
|
||||
// If `event` = `update`, then the payload will be a JSON string of a status.
|
||||
// If `event` = `notification`, then the payload will be a JSON string of a notification.
|
||||
// If `event` = `delete`, then the payload will be a status ID.
|
||||
// type: string
|
||||
// example: "{\"id\":\"01FC3TZ5CFG6H65GCKCJRKA669\",\"created_at\":\"2021-08-02T16:25:52Z\",\"sensitive\":false,\"spoiler_text\":\"\",\"visibility\":\"public\",\"language\":\"en\",\"uri\":\"https://gts.superseriousbusiness.org/users/dumpsterqueer/statuses/01FC3TZ5CFG6H65GCKCJRKA669\",\"url\":\"https://gts.superseriousbusiness.org/@dumpsterqueer/statuses/01FC3TZ5CFG6H65GCKCJRKA669\",\"replies_count\":0,\"reblogs_count\":0,\"favourites_count\":0,\"favourited\":false,\"reblogged\":false,\"muted\":false,\"bookmarked\":fals…//gts.superseriousbusiness.org/fileserver/01JNN207W98SGG3CBJ76R5MVDN/header/original/019036W043D8FXPJKSKCX7G965.png\",\"header_static\":\"https://gts.superseriousbusiness.org/fileserver/01JNN207W98SGG3CBJ76R5MVDN/header/small/019036W043D8FXPJKSKCX7G965.png\",\"followers_count\":33,\"following_count\":28,\"statuses_count\":126,\"last_status_at\":\"2021-08-02T16:25:52Z\",\"emojis\":[],\"fields\":[]},\"media_attachments\":[],\"mentions\":[],\"tags\":[],\"emojis\":[],\"card\":null,\"poll\":null,\"text\":\"a\"}"
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '400':
|
||||
// description: bad request
|
||||
func (m *Module) StreamGETHandler(c *gin.Context) {
|
||||
streamType := c.Query(StreamQueryKey)
|
||||
if streamType == "" {
|
||||
|
@@ -43,67 +43,72 @@ import (
|
||||
// <https://example.org/api/v1/timelines/home?limit=20&max_id=01FC3GSQ8A3MMJ43BPZSGEG29M>; rel="next", <https://example.org/api/v1/timelines/home?limit=20&min_id=01FC3KJW2GYXSDDRA6RWNDM46M>; rel="prev"
|
||||
// ````
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - timelines
|
||||
// ---
|
||||
// tags:
|
||||
// - timelines
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: max_id
|
||||
// type: string
|
||||
// description: |-
|
||||
// Return only statuses *OLDER* than the given max status ID.
|
||||
// The status with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// required: false
|
||||
// - name: since_id
|
||||
// type: string
|
||||
// description: |-
|
||||
// Return only statuses *NEWER* than the given since status ID.
|
||||
// The status with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// - name: min_id
|
||||
// type: string
|
||||
// description: |-
|
||||
// Return only statuses *NEWER* than the given since status ID.
|
||||
// The status with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// required: false
|
||||
// - name: limit
|
||||
// type: integer
|
||||
// description: Number of statuses to return.
|
||||
// default: 20
|
||||
// in: query
|
||||
// required: false
|
||||
// - name: local
|
||||
// type: boolean
|
||||
// description: Show only statuses posted by local accounts.
|
||||
// default: false
|
||||
// in: query
|
||||
// required: false
|
||||
// parameters:
|
||||
// -
|
||||
// name: max_id
|
||||
// type: string
|
||||
// description: >-
|
||||
// Return only statuses *OLDER* than the given max status ID.
|
||||
// The status with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// required: false
|
||||
// -
|
||||
// name: since_id
|
||||
// type: string
|
||||
// description: >-
|
||||
// Return only statuses *NEWER* than the given since status ID.
|
||||
// The status with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// -
|
||||
// name: min_id
|
||||
// type: string
|
||||
// description: >-
|
||||
// Return only statuses *NEWER* than the given since status ID.
|
||||
// The status with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// required: false
|
||||
// -
|
||||
// name: limit
|
||||
// type: integer
|
||||
// description: Number of statuses to return.
|
||||
// default: 20
|
||||
// in: query
|
||||
// required: false
|
||||
// -
|
||||
// name: local
|
||||
// type: boolean
|
||||
// description: Show only statuses posted by local accounts.
|
||||
// default: false
|
||||
// in: query
|
||||
// required: false
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:statuses
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:statuses
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// name: statuses
|
||||
// description: Array of statuses.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/status"
|
||||
// headers:
|
||||
// Link:
|
||||
// type: string
|
||||
// description: Links to the next and previous queries.
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '400':
|
||||
// description: bad request
|
||||
// responses:
|
||||
// '200':
|
||||
// name: statuses
|
||||
// description: Array of statuses.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/status"
|
||||
// headers:
|
||||
// Link:
|
||||
// type: string
|
||||
// description: Links to the next and previous queries.
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '400':
|
||||
// description: bad request
|
||||
func (m *Module) HomeTimelineGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -43,67 +43,72 @@ import (
|
||||
// <https://example.org/api/v1/timelines/public?limit=20&max_id=01FC3GSQ8A3MMJ43BPZSGEG29M>; rel="next", <https://example.org/api/v1/timelines/public?limit=20&min_id=01FC3KJW2GYXSDDRA6RWNDM46M>; rel="prev"
|
||||
// ````
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - timelines
|
||||
// ---
|
||||
// tags:
|
||||
// - timelines
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// - name: max_id
|
||||
// type: string
|
||||
// description: |-
|
||||
// Return only statuses *OLDER* than the given max status ID.
|
||||
// The status with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// required: false
|
||||
// - name: since_id
|
||||
// type: string
|
||||
// description: |-
|
||||
// Return only statuses *NEWER* than the given since status ID.
|
||||
// The status with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// - name: min_id
|
||||
// type: string
|
||||
// description: |-
|
||||
// Return only statuses *NEWER* than the given since status ID.
|
||||
// The status with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// required: false
|
||||
// - name: limit
|
||||
// type: integer
|
||||
// description: Number of statuses to return.
|
||||
// default: 20
|
||||
// in: query
|
||||
// required: false
|
||||
// - name: local
|
||||
// type: boolean
|
||||
// description: Show only statuses posted by local accounts.
|
||||
// default: false
|
||||
// in: query
|
||||
// required: false
|
||||
// parameters:
|
||||
// -
|
||||
// name: max_id
|
||||
// type: string
|
||||
// description: >-
|
||||
// Return only statuses *OLDER* than the given max status ID.
|
||||
// The status with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// required: false
|
||||
// -
|
||||
// name: since_id
|
||||
// type: string
|
||||
// description: >-
|
||||
// Return only statuses *NEWER* than the given since status ID.
|
||||
// The status with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// -
|
||||
// name: min_id
|
||||
// type: string
|
||||
// description: >-
|
||||
// Return only statuses *NEWER* than the given since status ID.
|
||||
// The status with the specified ID will not be included in the response.
|
||||
// in: query
|
||||
// required: false
|
||||
// -
|
||||
// name: limit
|
||||
// type: integer
|
||||
// description: Number of statuses to return.
|
||||
// default: 20
|
||||
// in: query
|
||||
// required: false
|
||||
// -
|
||||
// name: local
|
||||
// type: boolean
|
||||
// description: Show only statuses posted by local accounts.
|
||||
// default: false
|
||||
// in: query
|
||||
// required: false
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:statuses
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:statuses
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// name: statuses
|
||||
// description: Array of statuses.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/status"
|
||||
// headers:
|
||||
// Link:
|
||||
// type: string
|
||||
// description: Links to the next and previous queries.
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '400':
|
||||
// description: bad request
|
||||
// responses:
|
||||
// '200':
|
||||
// name: statuses
|
||||
// description: Array of statuses.
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/status"
|
||||
// headers:
|
||||
// Link:
|
||||
// type: string
|
||||
// description: Links to the next and previous queries.
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '400':
|
||||
// description: bad request
|
||||
func (m *Module) PublicTimelineGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -36,35 +36,35 @@ import (
|
||||
// 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'.
|
||||
//
|
||||
// ---
|
||||
// tags:
|
||||
// - user
|
||||
// ---
|
||||
// tags:
|
||||
// - user
|
||||
//
|
||||
// consumes:
|
||||
// - application/json
|
||||
// - application/xml
|
||||
// - application/x-www-form-urlencoded
|
||||
// consumes:
|
||||
// - application/json
|
||||
// - application/xml
|
||||
// - application/x-www-form-urlencoded
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:user
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:user
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: Change successful
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal error
|
||||
// responses:
|
||||
// '200':
|
||||
// description: Change successful
|
||||
// '400':
|
||||
// description: bad request
|
||||
// '401':
|
||||
// description: unauthorized
|
||||
// '403':
|
||||
// description: forbidden
|
||||
// '406':
|
||||
// description: not acceptable
|
||||
// '500':
|
||||
// description: internal error
|
||||
func (m *Module) PasswordChangePOSTHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
|
@@ -76,6 +76,8 @@ func (suite *UserStandardTestSuite) SetupTest() {
|
||||
suite.userModule = user.New(suite.processor).(*user.Module)
|
||||
testrig.StandardDBSetup(suite.db, suite.testAccounts)
|
||||
testrig.StandardStorageSetup(suite.storage, "../../../../testrig/media")
|
||||
|
||||
suite.NoError(suite.processor.Start())
|
||||
}
|
||||
|
||||
func (suite *UserStandardTestSuite) TearDownTest() {
|
||||
|
Reference in New Issue
Block a user