update mastotypes

This commit is contained in:
tsmethurst 2021-03-28 18:47:42 +02:00
parent e07692275a
commit 51e9e50145
2 changed files with 60 additions and 0 deletions

View file

@ -18,6 +18,8 @@
package mastotypes
import "mime/multipart"
// Account represents a mastodon-api Account object, as described here: https://docs.joinmastodon.org/entities/account/
type Account struct {
// The account id
@ -85,3 +87,45 @@ type AccountCreateRequest struct {
// The language of the confirmation email that will be sent
Locale string `form:"locale" binding:"required"`
}
// UpdateCredentialsRequest represents the form submitted during a PATCH request to /api/v1/accounts/update_credentials.
// See https://docs.joinmastodon.org/methods/accounts/
type UpdateCredentialsRequest struct {
// Whether the account should be shown in the profile directory.
Discoverable string `form:"discoverable"`
// Whether the account has a bot flag.
Bot bool `form:"bot"`
// The display name to use for the profile.
DisplayName string `form:"display_name"`
// The account bio.
Note string `form:"note"`
// Avatar image encoded using multipart/form-data
Avatar *multipart.FileHeader `form:"avatar"`
// Header image encoded using multipart/form-data
Header *multipart.FileHeader `form:"header"`
// Whether manual approval of follow requests is required.
Locked bool `form:"locked"`
// New Source values for this account
Source *UpdateSource `form:"source"`
// Profile metadata name and value
FieldsAttributes []UpdateField `form:"fields_attributes"`
}
// UpdateSource is to be used specifically in an UpdateCredentialsRequest.
type UpdateSource struct {
// Default post privacy for authored statuses.
Privacy string `form:"privacy"`
// Whether to mark authored statuses as sensitive by default.
Sensitive bool `form:"sensitive"`
// Default language to use for authored statuses. (ISO 6391)
Language string `form:"language"`
}
// UpdateField is to be used specifically in an UpdateCredentialsRequest.
// By default, max 4 fields and 255 characters per property/value.
type UpdateField struct {
// Name of the field
Name string `form:"name"`
// Value of the field
Value string `form:"value"`
}

View file

@ -22,4 +22,20 @@ package mastotypes
// Returned as an additional entity when verifying and updated credentials, as an attribute of Account.
// See https://docs.joinmastodon.org/entities/source/
type Source struct {
// The default post privacy to be used for new statuses.
// public = Public post
// unlisted = Unlisted post
// private = Followers-only post
// direct = Direct post
Privacy string `json:"privacy,omitempty"`
// Whether new statuses should be marked sensitive by default.
Sensitive bool `json:"sensitive,omitempty"`
// The default posting language for new statuses.
Language string `json:"language,omitempty"`
// Profile bio.
Note string `json:"note"`
// Metadata about the account.
Fields []Field `json:"fields"`
// The number of pending follow requests.
FollowRequestsCount int `json:"follow_requests_count,omitempty"`
}