account

package
v0.3.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2022 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LimitKey is for setting the return amount limit for eg., requesting an account's statuses
	LimitKey = "limit"
	// ExcludeRepliesKey is for specifying whether to exclude replies in a list of returned statuses by an account.
	ExcludeRepliesKey = "exclude_replies"
	// ExcludeReblogsKey is for specifying whether to exclude reblogs in a list of returned statuses by an account.
	ExcludeReblogsKey = "exclude_reblogs"
	// PinnedKey is for specifying whether to include pinned statuses in a list of returned statuses by an account.
	PinnedKey = "pinned"
	// MaxIDKey is for specifying the maximum ID of the status to retrieve.
	MaxIDKey = "max_id"
	// MinIDKey is for specifying the minimum ID of the status to retrieve.
	MinIDKey = "min_id"
	// OnlyMediaKey is for specifying that only statuses with media should be returned in a list of returned statuses by an account.
	OnlyMediaKey = "only_media"
	// OnlyPublicKey is for specifying that only statuses with visibility public should be returned in a list of returned statuses by account.
	OnlyPublicKey = "only_public"

	// IDKey is the key to use for retrieving account ID in requests
	IDKey = "id"
	// BasePath is the base API path for this module
	BasePath = "/api/v1/accounts"
	// BasePathWithID is the base path for this module with the ID key
	BasePathWithID = BasePath + "/:" + IDKey
	// VerifyPath is for verifying account credentials
	VerifyPath = BasePath + "/verify_credentials"
	// UpdateCredentialsPath is for updating account credentials
	UpdateCredentialsPath = BasePath + "/update_credentials"
	// GetStatusesPath is for showing an account's statuses
	GetStatusesPath = BasePathWithID + "/statuses"
	// GetFollowersPath is for showing an account's followers
	GetFollowersPath = BasePathWithID + "/followers"
	// GetFollowingPath is for showing account's that an account follows.
	GetFollowingPath = BasePathWithID + "/following"
	// GetRelationshipsPath is for showing an account's relationship with other accounts
	GetRelationshipsPath = BasePath + "/relationships"
	// FollowPath is for POSTing new follows to, and updating existing follows
	FollowPath = BasePathWithID + "/follow"
	// UnfollowPath is for POSTing an unfollow
	UnfollowPath = BasePathWithID + "/unfollow"
	// BlockPath is for creating a block of an account
	BlockPath = BasePathWithID + "/block"
	// UnblockPath is for removing a block of an account
	UnblockPath = BasePathWithID + "/unblock"
	// DeleteAccountPath is for deleting one's account via the API
	DeleteAccountPath = BasePath + "/delete"
)

Variables

This section is empty.

Functions

func New

func New(processor processing.Processor) api.ClientModule

New returns a new account module

Types

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module implements the ClientAPIModule interface for account-related actions

func (*Module) AccountBlockPOSTHandler

func (m *Module) AccountBlockPOSTHandler(c *gin.Context)

AccountBlockPOSTHandler swagger:operation POST /api/v1/accounts/{id}/block accountBlock

Block account with id.

--- tags: - accounts

produces: - application/json

parameters:

  • name: id type: string description: The id of the account to block. in: path required: true

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

func (*Module) AccountCreatePOSTHandler

func (m *Module) AccountCreatePOSTHandler(c *gin.Context)

AccountCreatePOSTHandler swagger:operation POST /api/v1/accounts accountCreate

Create a new account using an application token.

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

consumes: - application/json - application/xml - application/x-www-form-urlencoded

produces: - application/json

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

func (*Module) AccountDeletePOSTHandler added in v0.2.2

func (m *Module) AccountDeletePOSTHandler(c *gin.Context)

AccountDeletePOSTHandler swagger:operation POST /api/v1/accounts/delete accountDelete

Delete your account.

--- tags: - accounts

consumes: - multipart/form-data

parameters:

  • name: password in: formData description: Password of the account user, for confirmation. type: string required: true

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

func (*Module) AccountFollowPOSTHandler

func (m *Module) AccountFollowPOSTHandler(c *gin.Context)

AccountFollowPOSTHandler swagger:operation POST /api/v1/accounts/{id}/follow accountFollow

Follow account with id.

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

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

produces: - application/json

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

func (*Module) AccountFollowersGETHandler

func (m *Module) AccountFollowersGETHandler(c *gin.Context)

AccountFollowersGETHandler swagger:operation GET /api/v1/accounts/{id}/followers accountFollowers

See followers of account with given id.

--- tags: - accounts

produces: - application/json

parameters:

  • name: id type: string description: Account ID. in: path required: true

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

func (*Module) AccountFollowingGETHandler

func (m *Module) AccountFollowingGETHandler(c *gin.Context)

AccountFollowingGETHandler swagger:operation GET /api/v1/accounts/{id}/following accountFollowing

See accounts followed by given account id.

--- tags: - accounts

produces: - application/json

parameters:

  • name: id type: string description: Account ID. in: path required: true

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

func (*Module) AccountGETHandler

func (m *Module) AccountGETHandler(c *gin.Context)

AccountGETHandler swagger:operation GET /api/v1/accounts/{id} accountGet

Get information about an account with the given ID.

--- tags: - accounts

produces: - application/json

parameters:

  • name: id type: string description: The id of the requested account. in: path required: true

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

func (*Module) AccountRelationshipsGETHandler

func (m *Module) AccountRelationshipsGETHandler(c *gin.Context)

AccountRelationshipsGETHandler swagger:operation GET /api/v1/accounts/relationships accountRelationships

See your account's relationships with the given account IDs.

--- tags: - accounts

produces: - application/json

parameters:

  • name: id type: array items: type: string description: Account IDs. in: query required: true

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

func (*Module) AccountStatusesGETHandler

func (m *Module) AccountStatusesGETHandler(c *gin.Context)

AccountStatusesGETHandler swagger:operation GET /api/v1/accounts/{id}/statuses accountStatuses

See statuses posted by the requested account.

The statuses will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer).

--- tags: - accounts

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

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

func (*Module) AccountUnblockPOSTHandler

func (m *Module) AccountUnblockPOSTHandler(c *gin.Context)

AccountUnblockPOSTHandler swagger:operation POST /api/v1/accounts/{id}/unblock accountUnblock

Unblock account with ID.

--- tags: - accounts

produces: - application/json

parameters:

  • name: id type: string description: The id of the account to unblock. in: path required: true

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

func (*Module) AccountUnfollowPOSTHandler

func (m *Module) AccountUnfollowPOSTHandler(c *gin.Context)

AccountUnfollowPOSTHandler swagger:operation POST /api/v1/accounts/{id}/unfollow accountUnfollow

Unfollow account with id.

--- tags: - accounts

produces: - application/json

parameters:

  • name: id type: string description: The id of the account to unfollow. in: path required: true

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

func (*Module) AccountUpdateCredentialsPATCHHandler

func (m *Module) AccountUpdateCredentialsPATCHHandler(c *gin.Context)

AccountUpdateCredentialsPATCHHandler swagger:operation PATCH /api/v1/accounts/update_credentials accountUpdate

Update your account.

--- tags: - accounts

consumes: - multipart/form-data

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

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

func (*Module) AccountVerifyGETHandler

func (m *Module) AccountVerifyGETHandler(c *gin.Context)

AccountVerifyGETHandler swagger:operation GET /api/v1/accounts/verify_credentials accountVerify

Verify a token by returning account details pertaining to it.

--- tags: - accounts

produces: - application/json

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

func (*Module) Route

func (m *Module) Route(r router.Router) error

Route attaches all routes from this module to the given router

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL