Documentation ¶
Overview ¶
Package mastodon implements a Mastodon API service.
Index ¶
- Constants
- func AccountsFamiliarFollowersShow(env *Env, w http.ResponseWriter, req *http.Request) error
- func AccountsFeaturedTagsShow(env *Env, w http.ResponseWriter, r *http.Request) error
- func AccountsFollowersShow(env *Env, w http.ResponseWriter, r *http.Request) error
- func AccountsFollowingShow(env *Env, w http.ResponseWriter, r *http.Request) error
- func AccountsShow(env *Env, w http.ResponseWriter, r *http.Request) error
- func AccountsShowListMembership(env *Env, w http.ResponseWriter, r *http.Request) error
- func AccountsStatusesShow(env *Env, w http.ResponseWriter, r *http.Request) error
- func AccountsUpdateCredentials(env *Env, w http.ResponseWriter, r *http.Request) error
- func AccountsVerifyCredentials(env *Env, w http.ResponseWriter, r *http.Request) error
- func AppsCreate(env *Env, w http.ResponseWriter, r *http.Request) error
- func BlocksCreate(env *Env, w http.ResponseWriter, r *http.Request) error
- func BlocksDestroy(env *Env, w http.ResponseWriter, r *http.Request) error
- func BlocksIndex(env *Env, w http.ResponseWriter, r *http.Request) error
- func BookmarksCreate(env *Env, w http.ResponseWriter, r *http.Request) error
- func BookmarksDestroy(env *Env, w http.ResponseWriter, r *http.Request) error
- func BookmarksIndex(env *Env, w http.ResponseWriter, r *http.Request) error
- func ConversationsIndex(env *Env, w http.ResponseWriter, r *http.Request) error
- func DirectoryIndex(env *Env, w http.ResponseWriter, r *http.Request) error
- func EmojisIndex(env *Env, w http.ResponseWriter, r *http.Request) error
- func FavouritesCreate(env *Env, w http.ResponseWriter, r *http.Request) error
- func FavouritesDestroy(env *Env, w http.ResponseWriter, r *http.Request) error
- func FavouritesIndex(env *Env, w http.ResponseWriter, r *http.Request) error
- func FiltersIndex(env *Env, w http.ResponseWriter, r *http.Request) error
- func InstancesActivityShow(env *Env, w http.ResponseWriter, r *http.Request) error
- func InstancesDomainBlocksShow(env *Env, w http.ResponseWriter, r *http.Request) error
- func InstancesIndexV1(env *Env, w http.ResponseWriter, r *http.Request) error
- func InstancesIndexV2(env *Env, w http.ResponseWriter, r *http.Request) error
- func InstancesPeersShow(env *Env, w http.ResponseWriter, r *http.Request) error
- func InstancesRulesShow(env *Env, w http.ResponseWriter, r *http.Request) error
- func ListsAddMembers(env *Env, w http.ResponseWriter, r *http.Request) error
- func ListsCreate(env *Env, w http.ResponseWriter, r *http.Request) error
- func ListsIndex(env *Env, w http.ResponseWriter, r *http.Request) error
- func ListsRemoveMembers(env *Env, w http.ResponseWriter, r *http.Request) error
- func ListsShow(env *Env, w http.ResponseWriter, r *http.Request) error
- func ListsViewMembers(env *Env, w http.ResponseWriter, r *http.Request) error
- func MarkersCreate(env *Env, w http.ResponseWriter, r *http.Request) error
- func MarkersIndex(env *Env, w http.ResponseWriter, r *http.Request) error
- func MutesCreate(env *Env, w http.ResponseWriter, r *http.Request) error
- func MutesDestroy(env *Env, w http.ResponseWriter, r *http.Request) error
- func MutesIndex(env *Env, w http.ResponseWriter, r *http.Request) error
- func NotificationsIndex(env *Env, w http.ResponseWriter, r *http.Request) error
- func PreferencesShow(env *Env, w http.ResponseWriter, r *http.Request) error
- func PushSubscriptionCreate(env *Env, w http.ResponseWriter, r *http.Request) error
- func PushSubscriptionDestroy(env *Env, w http.ResponseWriter, r *http.Request) error
- func PushSubscriptionShow(env *Env, w http.ResponseWriter, r *http.Request) error
- func PushSubscriptionUpdate(env *Env, w http.ResponseWriter, r *http.Request) error
- func RelationshipsCreate(env *Env, w http.ResponseWriter, req *http.Request) error
- func RelationshipsDestroy(env *Env, w http.ResponseWriter, req *http.Request) error
- func RelationshipsShow(env *Env, w http.ResponseWriter, req *http.Request) error
- func SearchIndex(env *Env, w http.ResponseWriter, r *http.Request) error
- func StatusesContextsShow(env *Env, w http.ResponseWriter, r *http.Request) error
- func StatusesCreate(env *Env, w http.ResponseWriter, r *http.Request) error
- func StatusesDestroy(env *Env, w http.ResponseWriter, r *http.Request) error
- func StatusesFavouritesShow(env *Env, w http.ResponseWriter, r *http.Request) error
- func StatusesHistoryShow(env *Env, w http.ResponseWriter, r *http.Request) error
- func StatusesReblogCreate(env *Env, w http.ResponseWriter, r *http.Request) error
- func StatusesReblogDestroy(env *Env, w http.ResponseWriter, r *http.Request) error
- func StatusesReblogsShow(env *Env, w http.ResponseWriter, r *http.Request) error
- func StatusesShow(env *Env, w http.ResponseWriter, r *http.Request) error
- func StreamingHealth(env *Env, w http.ResponseWriter, r *http.Request) error
- func StreamingPublic(env *Env, w http.ResponseWriter, r *http.Request) error
- func StreamingWebsocket(env *Env, w http.ResponseWriter, r *http.Request) error
- func TimelinesHome(env *Env, w http.ResponseWriter, r *http.Request) error
- func TimelinesListShow(env *Env, w http.ResponseWriter, r *http.Request) error
- func TimelinesPublic(env *Env, w http.ResponseWriter, r *http.Request) error
- func TimelinesTagShow(env *Env, w http.ResponseWriter, r *http.Request) error
- type Account
- type Alerts
- type Application
- type BoolOrBit
- type CredentialAccount
- type Env
- type FamiliarFollowers
- type Field
- type List
- type Marker
- type MediaAttachment
- type Mention
- type Meta
- type MetaFocus
- type MetaFormat
- type Poll
- type PollOption
- type Preferences
- type Relationship
- type Role
- type Serialiser
- func (s *Serialiser) Account(a *models.Actor) *Account
- func (s *Serialiser) Application(a *models.Application) *Application
- func (s *Serialiser) CredentialAccount(a *models.Account) *CredentialAccount
- func (s *Serialiser) List(l *models.AccountList) *List
- func (s *Serialiser) Marker(m *models.AccountMarker) *Marker
- func (s *Serialiser) MediaAttachments(attachments []*models.StatusAttachment) []*MediaAttachment
- func (s *Serialiser) Mentions(mentions []models.StatusMention) []*Mention
- func (s *Serialiser) Poll(p *models.StatusPoll) *Poll
- func (s *Serialiser) Preferences(prefs *models.AccountPreferences) *Preferences
- func (s *Serialiser) Relationship(rel *models.Relationship) *Relationship
- func (s *Serialiser) Role(ar *models.AccountRole) *Role
- func (s *Serialiser) Status(st *models.Status) *Status
- func (s *Serialiser) StatusEdit(st *models.Status) *StatusEdit
- func (s *Serialiser) Tags(tags []models.StatusTag) []*Tag
- func (s *Serialiser) WebPushSubscription(sub *models.PushSubscription) *WebPushSubscription
- type Source
- type Status
- type StatusEdit
- type Tag
- type WebPushSubscription
Constants ¶
View Source
const ( PREVIEW_MAX_WIDTH = 560 PREVIEW_MAX_HEIGHT = 415 )
Variables ¶
This section is empty.
Functions ¶
func AccountsFollowersShow ¶
func AccountsFollowingShow ¶
func AccountsShow ¶
func AccountsStatusesShow ¶
func AppsCreate ¶
func BlocksCreate ¶
func BlocksDestroy ¶
func BlocksIndex ¶
func BookmarksCreate ¶
func BookmarksDestroy ¶
func BookmarksIndex ¶
func ConversationsIndex ¶
func DirectoryIndex ¶
func EmojisIndex ¶
func FavouritesCreate ¶
func FavouritesDestroy ¶
func FavouritesIndex ¶
func FiltersIndex ¶
func InstancesActivityShow ¶
func InstancesIndexV1 ¶
func InstancesIndexV2 ¶
func InstancesPeersShow ¶
func InstancesRulesShow ¶
func ListsAddMembers ¶
func ListsCreate ¶
func ListsIndex ¶
func ListsRemoveMembers ¶
func ListsViewMembers ¶
func MarkersCreate ¶
func MarkersIndex ¶
func MutesCreate ¶
func MutesDestroy ¶
func MutesIndex ¶
func NotificationsIndex ¶
func PreferencesShow ¶
func PushSubscriptionCreate ¶
func PushSubscriptionDestroy ¶
func PushSubscriptionShow ¶
func PushSubscriptionUpdate ¶
func RelationshipsCreate ¶
func RelationshipsDestroy ¶
func RelationshipsShow ¶
func SearchIndex ¶
func StatusesContextsShow ¶
func StatusesCreate ¶
func StatusesDestroy ¶
func StatusesFavouritesShow ¶
func StatusesHistoryShow ¶
func StatusesReblogCreate ¶
func StatusesReblogDestroy ¶
func StatusesReblogsShow ¶
func StatusesShow ¶
func StreamingHealth ¶
func StreamingPublic ¶
func StreamingWebsocket ¶
func TimelinesHome ¶
func TimelinesListShow ¶
func TimelinesPublic ¶
func TimelinesTagShow ¶
Types ¶
type Account ¶
type Account struct { ID snowflake.ID `json:"id,string"` Username string `json:"username"` Acct string `json:"acct"` DisplayName string `json:"display_name"` Locked bool `json:"locked"` Bot bool `json:"bot"` Discoverable bool `json:"discoverable"` Group bool `json:"group"` CreatedAt string `json:"created_at"` Note string `json:"note"` URL string `json:"url"` Avatar string `json:"avatar"` // these four fields _cannot_ be blank AvatarStatic string `json:"avatar_static"` // if they are, various clients will consider the Header string `json:"header"` // account to be invalid and ignore it or just go weird :grr: HeaderStatic string `json:"header_static"` // so they must be set to a default image. FollowersCount int32 `json:"followers_count"` FollowingCount int32 `json:"following_count"` StatusesCount int32 `json:"statuses_count"` LastStatusAt *string `json:"last_status_at"` // NoIndex bool `json:"noindex"` // default false Emojis []map[string]any `json:"emojis"` Fields []Field `json:"fields"` }
type Application ¶
type Application struct { ID snowflake.ID `json:"id,string"` Name string `json:"name"` Website any `json:"website"` // string or null RedirectURI string `json:"redirect_uri,omitempty"` VapidKey string `json:"vapid_key"` ClientID string `json:"client_id,omitempty"` ClientSecret string `json:"client_secret,omitempty"` }
type BoolOrBit ¶
type BoolOrBit bool
BoolOrBit is a type that can be unmarshalled from a JSON boolean or a JSON string iOS Ivory v13102+ sends "status": "1" or "status": "0" instead of "status": true or "status": false Credit to @diligiant for figuring this out and providing the code
func (*BoolOrBit) UnmarshalJSON ¶
type CredentialAccount ¶
type FamiliarFollowers ¶
type Marker ¶
type MediaAttachment ¶
type MediaAttachment struct { ID snowflake.ID `json:"id,string"` Type string `json:"type"` URL string `json:"url"` PreviewURL string `json:"preview_url,omitempty"` RemoteURL any `json:"remote_url,omitempty"` PreviewRemoteURL any `json:"preview_remote_url,omitempty"` TextURL any `json:"text_url,omitempty"` Meta Meta `json:"meta"` Description string `json:"description,omitempty"` Blurhash string `json:"blurhash,omitempty"` }
type Mention ¶
type Mention struct { ID snowflake.ID `json:"id,string"` URL string `json:"url"` Acct string `json:"acct"` Username string `json:"username"` }
Mention represents a mention of a user in the context of a status. https://docs.joinmastodon.org/entities/Status/#Mention
type Meta ¶
type Meta struct { Original *MetaFormat `json:"original,omitempty"` Small *MetaFormat `json:"small,omitempty"` Focus *MetaFocus `json:"focus,omitempty"` Length string `json:"length,omitempty"` Duration float64 `json:"duration,omitzero"` FPS int `json:"fps,omitzero"` Size string `json:"size,omitempty"` Width int `json:"width,omitzero"` Height int `json:"height,omitzero"` Aspect float64 `json:"aspect,omitzero"` AudioEncode string `json:"audio_encode,omitempty"` AudioBitrate string `json:"audio_bitrate,omitempty"` AudioChannels string `json:"audio_channels,omitempty"` }
type MetaFormat ¶
type MetaFormat struct { Width int `json:"width,omitempty"` Height int `json:"height,omitempty"` Size string `json:"size,omitempty"` Aspect float64 `json:"aspect,omitzero"` FrameRate string `json:"frame_rate,omitempty"` Duration float64 `json:"duration,omitzero"` Bitrate string `json:"bitrate,omitempty"` }
type Poll ¶
type Poll struct { ID snowflake.ID `json:"id,string"` ExpiresAt string `json:"expires_at"` Expired bool `json:"expired"` Multiple bool `json:"multiple"` VotesCount int `json:"votes_count"` VotersCount *int `json:"voters_count"` Voted bool `json:"voted"` OwnVotes []int `json:"own_votes"` Options []PollOption `json:"options"` Emojis []any `json:"emojis"` }
type PollOption ¶
type Preferences ¶
type Preferences struct { PostingDefaultVisibility string `json:"posting:default:visibility"` PostingDefaultSensitive bool `json:"posting:default:sensitive"` PostingDefaultLanguage any `json:"posting:default:language"` ReadingExpandMedia string `json:"reading:expand:media"` ReadingExpandSpoilers bool `json:"reading:expand:spoilers"` }
type Relationship ¶
type Relationship struct { ID snowflake.ID `json:"id,string"` Following bool `json:"following"` ShowingReblogs bool `json:"showing_reblogs"` Notifying bool `json:"notifying"` FollowedBy bool `json:"followed_by"` Blocking bool `json:"blocking"` BlockedBy bool `json:"blocked_by"` Muting bool `json:"muting"` MutingNotifications bool `json:"muting_notifications"` Requested bool `json:"requested"` DomainBlocking bool `json:"domain_blocking"` Endorsed bool `json:"endorsed"` Note string `json:"note"` }
type Serialiser ¶
type Serialiser struct {
// contains filtered or unexported fields
}
Seraliser contains methods to seralise various Mastodon REST API responses.
func NewSerialiser ¶
func NewSerialiser(req *http.Request) Serialiser
func (*Serialiser) Application ¶
func (s *Serialiser) Application(a *models.Application) *Application
func (*Serialiser) CredentialAccount ¶
func (s *Serialiser) CredentialAccount(a *models.Account) *CredentialAccount
func (*Serialiser) List ¶
func (s *Serialiser) List(l *models.AccountList) *List
func (*Serialiser) Marker ¶
func (s *Serialiser) Marker(m *models.AccountMarker) *Marker
func (*Serialiser) MediaAttachments ¶
func (s *Serialiser) MediaAttachments(attachments []*models.StatusAttachment) []*MediaAttachment
func (*Serialiser) Mentions ¶
func (s *Serialiser) Mentions(mentions []models.StatusMention) []*Mention
func (*Serialiser) Poll ¶
func (s *Serialiser) Poll(p *models.StatusPoll) *Poll
func (*Serialiser) Preferences ¶
func (s *Serialiser) Preferences(prefs *models.AccountPreferences) *Preferences
func (*Serialiser) Relationship ¶
func (s *Serialiser) Relationship(rel *models.Relationship) *Relationship
func (*Serialiser) Role ¶
func (s *Serialiser) Role(ar *models.AccountRole) *Role
func (*Serialiser) StatusEdit ¶
func (s *Serialiser) StatusEdit(st *models.Status) *StatusEdit
func (*Serialiser) WebPushSubscription ¶
func (s *Serialiser) WebPushSubscription(sub *models.PushSubscription) *WebPushSubscription
type Status ¶
type Status struct { ID snowflake.ID `json:"id,string"` CreatedAt string `json:"created_at"` InReplyToID *snowflake.ID `json:"in_reply_to_id,string"` InReplyToAccountID *snowflake.ID `json:"in_reply_to_account_id,string"` Sensitive bool `json:"sensitive"` SpoilerText string `json:"spoiler_text"` Visibility models.Visibility `json:"visibility"` Language any `json:"language"` URI string `json:"uri"` URL any `json:"url"` RepliesCount int `json:"replies_count"` ReblogsCount int `json:"reblogs_count"` FavouritesCount int `json:"favourites_count"` EditedAt any `json:"edited_at"` Favourited bool `json:"favourited"` Reblogged bool `json:"reblogged"` Muted bool `json:"muted"` Pinned bool `json:"pinned"` Bookmarked bool `json:"bookmarked"` Content string `json:"content"` Filtered []any `json:"filtered,omitempty"` Reblog *Status `json:"reblog"` Application any `json:"application,omitempty"` Account *Account `json:"account"` MediaAttachments []*MediaAttachment `json:"media_attachments"` Mentions []*Mention `json:"mentions"` Tags []*Tag `json:"tags"` Emojis []any `json:"emojis"` Card any `json:"card"` Poll *Poll `json:"poll"` }
Status is a representation of a Mastodon Status object. https://docs.joinmastodon.org/entities/Status/
type StatusEdit ¶
type StatusEdit struct { Content string `json:"content"` SpoilerText string `json:"spoiler_text"` Sensitive bool `json:"sensitive"` CreatedAt string `json:"created_at"` // updated_at if edited, created_at if original Account *Account `json:"account"` Poll *Poll `json:"poll"` MediaAttachments []*MediaAttachment `json:"media_attachments"` Emojis []any `json:"emojis"` }
Source Files ¶
- accounts.go
- apps.go
- blocks.go
- bookmarks.go
- conversations.go
- directory.go
- emojis.go
- favourites.go
- filters.go
- instances.go
- lists.go
- markers.go
- mastodon.go
- mutes.go
- notifications.go
- preferences.go
- pushsubscription.go
- relationships.go
- search.go
- serialisers.go
- statuses.go
- streaming.go
- timeline.go
- types.go
Click to show internal directories.
Click to hide internal directories.