Documentation ¶
Index ¶
- Constants
- func AddAccountsToList(baseUrl, accessToken, listId string, accounts ...string) error
- func AuthorizeFollowRequest(baseUrl, accessToken, accountId string) error
- func BlockDomain(baseUrl, accessToken, domain string) error
- func ClearNotifications(baseUrl, accessToken string) error
- func Contexts(context ...string) []string
- func DeleteFilter(baseUrl, accessToken, filterId string) error
- func DeleteFollowSuggestion(baseUrl, accessToken, accountId string) error
- func DeleteList(baseUrl, accessToken, listId string) error
- func DeleteScheduledStatus(baseUrl, accessToken, scheduledId string) error
- func DeleteStatus(baseUrl, accessToken, statusId string) error
- func DeleteSubscription(baseUrl, accessToken string) error
- func DismissNotification(baseUrl, accessToken, notificationId string) error
- func FocalPoint(x, y float64) string
- func GetAuthorizeUrl(baseUrl, clientId, scope, redirectUri string) string
- func GetDomainBlocks(baseUrl, accessToken string, limit int) ([]string, string, string, error)
- func GetUrl(url, accessToken string, out interface{}) (http.Header, string, string, string, error)
- func RejectFollowRequest(baseUrl, accessToken, accountId string) error
- func RemoveAccountsFromList(baseUrl, accessToken, listId string, accounts ...string) error
- func Report(baseUrl, accessToken, accountId string, statusIds []string, comment string, ...) error
- func RevokeToken(baseUrl, clientId, clientSecret, accessToken string) error
- func Scopes(permission ...string) string
- func UnblockDomain(baseUrl, accessToken, domain string) error
- type Account
- func GetAccount(baseUrl, accountId string) (Account, error)
- func GetAccountBlocks(baseUrl, accessToken string, limit int) ([]Account, string, string, error)
- func GetAssociatedAccount(baseUrl, accessToken string) (Account, error)
- func GetEndorsements(baseUrl, accessToken string, limit int) ([]Account, string, string, error)
- func GetFollowRequests(baseUrl, accessToken string, limit int) ([]Account, string, string, error)
- func GetFollowSuggestions(baseUrl, accessToken string) ([]Account, error)
- func GetFolloweds(baseUrl, accessToken, accountId string, limit int) ([]Account, string, string, error)
- func GetFollowers(baseUrl, accessToken, accountId string, limit int) ([]Account, string, string, error)
- func GetMutes(baseUrl, accessToken string, limit int) ([]Account, string, string, error)
- func GetStatusFavouritedBy(baseUrl, statusId string, limit int) ([]Account, string, string, error)
- func GetStatusRebloggedBy(baseUrl, statusId string, limit int) ([]Account, string, string, error)
- func ListAccounts(baseUrl, accessToken, listId string, limit int) ([]Account, string, string, error)
- func SearchAccounts(baseUrl, accessToken, query string, limit int, resolve, following bool) ([]Account, error)
- func UpdateProfile(...) (Account, error)
- func UpdateProfileAvatar(baseUrl, accessToken, path string) (Account, error)
- func UpdateProfileHeader(baseUrl, accessToken, path string) (Account, error)
- func VerifyAccountCredentials(baseUrl, accessToken string) (Account, error)
- type AccountBook
- func GetAccountBlocksBook(baseUrl, accessToken string, limit int) AccountBook
- func GetEndorsementsBook(baseUrl, accessToken string, limit int) AccountBook
- func GetFollowRequestsBook(baseUrl, accessToken string, limit int) AccountBook
- func GetFollowedsBook(baseUrl, accessToken, accountId string, limit int) AccountBook
- func GetFollowersBook(baseUrl, accessToken, accountId string, limit int) AccountBook
- func GetMutesBook(baseUrl, accessToken string, limit int) AccountBook
- func GetStatusFavouritedByBook(baseUrl, statusId string, limit int) AccountBook
- func GetStatusRebloggedByBook(baseUrl, statusId string, limit int) AccountBook
- func ListAccountsBook(baseUrl, accessToken, listId string, limit int) AccountBook
- func NewAccountBook(accessToken string) AccountBook
- type Alerts
- type App
- type Application
- type Attachment
- type Book
- type Card
- type Context
- type Conversation
- type ConversationBook
- func (book *ConversationBook) All() []Conversation
- func (book *ConversationBook) Get(url, accessToken string) ([]Conversation, string, string, error)
- func (book *ConversationBook) Next() []Conversation
- func (book *ConversationBook) Previous() []Conversation
- func (book *ConversationBook) Update(url string) []Conversation
- type Emoji
- type Error
- type Field
- type Filter
- func CreateFilter(baseUrl, accessToken, phrase string, context []string, ...) (Filter, error)
- func GetFilter(baseUrl, accessToken, filterId string) (Filter, error)
- func GetFilters(baseUrl, accessToken string) ([]Filter, error)
- func UpdateFilter(baseUrl, accessToken, filterId, phrase string, context []string, ...) (Filter, error)
- type Focus
- type History
- type Instance
- type List
- func CreateList(baseUrl, accessToken, title string) (List, error)
- func GetList(baseUrl, accessToken, listId string) (List, error)
- func GetLists(baseUrl, accessToken string) ([]List, error)
- func GetListsWithAccount(baseUrl, accessToken, accountId string) ([]List, error)
- func UpdateList(baseUrl, accessToken, listId, title string) (List, error)
- type Media
- type Mention
- type Meta
- type MetaAttributes
- type Notification
- type NotificationBook
- func (book *NotificationBook) All() []Notification
- func (book *NotificationBook) Get(url, accessToken string) ([]Notification, string, string, error)
- func (book *NotificationBook) Next() []Notification
- func (book *NotificationBook) Previous() []Notification
- func (book *NotificationBook) Update(url string) []Notification
- type Poll
- type PollOption
- type PushSubscription
- func CreateSubscription(baseUrl, accessToken, endpoint, p256dh, auth string, ...) (PushSubscription, error)
- func GetSubscription(baseUrl, accessToken string) (PushSubscription, error)
- func UpdateSubscription(baseUrl, accessToken string, follow, favourite, reblog, mention, poll bool) (PushSubscription, error)
- type Relationship
- func BlockAccount(baseUrl, accessToken, accountId string) (Relationship, error)
- func EndorseAccount(baseUrl, accessToken, accountId string) (Relationship, error)
- func FollowAccount(baseUrl, accessToken, accountId string, hideReblogs string) (Relationship, error)
- func GetRelationships(baseUrl, accessToken string, accountIds ...string) ([]Relationship, error)
- func MuteAccount(baseUrl, accessToken, accountId string, notifications bool) (Relationship, error)
- func UnblockAccount(baseUrl, accessToken, accountId string) (Relationship, error)
- func UnendorseAccount(baseUrl, accessToken, accountId string) (Relationship, error)
- func UnfollowAccount(baseUrl, accessToken, accountId string) (Relationship, error)
- func UnmuteAccount(baseUrl, accessToken, accountId string) (Relationship, error)
- type Result
- type ScheduledStatus
- func GetScheduledStatus(baseUrl, accessToken, scheduledId string) (ScheduledStatus, error)
- func GetScheduledStatuses(baseUrl, accessToken string) ([]ScheduledStatus, error)
- func ScheduleMediaStatus(baseUrl, accessToken, status, scheduledAt, inReplyToId string, ...) (ScheduledStatus, error)
- func SchedulePollStatus(baseUrl, accessToken, status, scheduledAt, inReplyToId string, ...) (ScheduledStatus, error)
- func ScheduleStatus(baseUrl, accessToken, status, scheduledAt, inReplyToId string, ...) (ScheduledStatus, error)
- func ScheduleTextStatus(baseUrl, accessToken, status, scheduledAt, inReplyToId string, sensitive bool, ...) (ScheduledStatus, error)
- func UpdateScheduledStatus(baseUrl, accessToken, scheduledId, scheduledAt string) (ScheduledStatus, error)
- func UploadAndScheduleMediaStatus(baseUrl, accessToken, status, scheduledAt, inReplyToId string, medias []Media, ...) (ScheduledStatus, error)
- type Source
- type Stats
- type Status
- func FavouriteStatus(baseUrl, accessToken, statusId string) (Status, error)
- func GetFavourites(baseUrl, accessToken string, limit int) ([]Status, string, string, error)
- func GetHashtagTimeline(baseUrl, accessToken, hashTag string, local, onlyMedia bool, ...) ([]Status, string, string, error)
- func GetHomeTimeline(baseUrl, accessToken, maxId, sinceId, minId string, limit int) ([]Status, string, string, error)
- func GetListTimeline(baseUrl, accessToken, listId, maxId, sinceId, minId string, limit int) ([]Status, string, string, error)
- func GetPublicTimeline(baseUrl, accessToken string, local, onlyMedia bool, ...) ([]Status, string, string, error)
- func GetStatus(baseUrl, statusId string) (Status, error)
- func GetStatusesOfAccount(baseUrl, accessToken, accountId string, ...) ([]Status, string, string, error)
- func MuteStatus(baseUrl, accessToken, statusId string) (Status, error)
- func PinStatus(baseUrl, accessToken, statusId string) (Status, error)
- func PostMediaStatus(baseUrl, accessToken, status, inReplyToId string, mediaIds []string, ...) (Status, error)
- func PostPollStatus(baseUrl, accessToken, status, inReplyToId string, pollOptions []string, ...) (Status, error)
- func PostStatus(baseUrl, accessToken, status, inReplyToId string, mediaIds []string, ...) (Status, error)
- func PostTextStatus(baseUrl, accessToken, status, inReplyToId string, sensitive bool, ...) (Status, error)
- func ReblogStatus(baseUrl, accessToken, statusId string) (Status, error)
- func UnfavouriteStatus(baseUrl, accessToken, statusId string) (Status, error)
- func UnmuteStatus(baseUrl, accessToken, statusId string) (Status, error)
- func UnpinStatus(baseUrl, accessToken, statusId string) (Status, error)
- func UnreblogStatus(baseUrl, accessToken, statusId string) (Status, error)
- func UploadAndPostMediaStatus(baseUrl, accessToken, status, inReplyToId string, medias []Media, ...) (Status, error)
- type StatusBook
- func GetFavouritesBook(baseUrl, accessToken string, limit int) StatusBook
- func GetHashtagTimelineBook(baseUrl, accessToken, hashTag string, local, onlyMedia bool, limit int) StatusBook
- func GetHomeTimelineBook(baseUrl, accessToken string, limit int) StatusBook
- func GetListTimelineBook(baseUrl, accessToken, listId string, limit int) StatusBook
- func GetPublicTimelineBook(baseUrl, accessToken string, local, onlyMedia bool, limit int) StatusBook
- func GetStatusesOfAccountBook(baseUrl, accessToken, accountId string, ...) StatusBook
- func NewStatusBook(accessToken string) StatusBook
- type StatusParams
- type StringBook
- type Tag
- type Token
- func CreateAccount(baseUrl, accessToken, username, email, password string, agreement bool, ...) (Token, error)
- func GetAccessTokenFromAuthorizationCode(baseUrl, clientId, clientSecret, authorizationCode, scope, redirectUri string) (Token, error)
- func GetAccessTokenFromCredentials(baseUrl, clientId, clientSecret, scope string) (Token, error)
- func GetAccessTokenFromLogin(baseUrl, clientId, clientSecret, username, password, scope, redirectUri string) (Token, error)
- type URLs
Constants ¶
const ( ScopeWrite string = "write" ScopeWriteAccounts string = "write:accounts" ScopeWriteBlocks string = "write:blocks" ScopeWriteConversations string = "write:conversations" ScopeWriteFavourites string = "write:favourites" ScopeWriteFilters string = "write:filters" ScopeWriteFollows string = "write:follows" ScopeWriteLists string = "write:lists" ScopeWriteMedia string = "write:media" ScopeWriteMutes string = "write:mutes" ScopeWriteNotifications string = "write:notifications" ScopeWriteReports string = "write:reports" ScopeWriteStatuses string = "write:statuses" ScopeRead string = "read" ScopeReadAccounts string = "read:accounts" ScopeReadBlocks string = "read:blocks" ScopeReadFavourites string = "read:favourites" ScopeReadFilters string = "read:filters" ScopeReadFollows string = "read:follows" ScopeReadLists string = "read:lists" ScopeReadMutes string = "read:mutes" ScopeReadNotifications string = "read:notifications" ScopeReadSearch string = "read:search" ScopeReadStatuses string = "read:statuses" ScopeFollow string = "follow" ScopePush string = "push" ScopeAdminRead string = "admin:read" ScopeAdminReadAccounts string = "admin:read:accounts" ScopeAdminReadReports string = "admin:read:reports" ScopeAdminWrite string = "admin:write" ScopeAdminWriteAccounts string = "admin:write:accounts" ScopeAdminWriteReports string = "admin:write:reports" VisibilityPublic string = "public" // Visibility used when posting a status VisibilityUnlisted string = "unlisted" // Visibility used when posting a status VisibilityPrivate string = "private" // Visibility used when posting a status VisibilityDirect string = "direct" // Visibility used when posting a status AttachmentUnknown string = "unknown" // Type of the attachment of a media post AttachmentImage string = "image" // Type of the attachment of a media post AttachmentGifv string = "gifv" // Type of the attachment of a media post AttachmentVideo string = "video" // Type of the attachment of a media post CardLink string = "link" // Type of status card CardPhoto string = "photo" // Type of status card CardVideo string = "video" // Type of status card CardRich string = "rich" // Type of status card ContextHome string = "home" // Context of a timeline ContextNotifications string = "notifications" // Context of a timeline ContextPublic string = "public" // Context of a timeline ContextThread string = "thread" // Context of a timeline DurationMinute int = 60 // Shortcut for a duration of a minute DurationHalfHour int = 30 * DurationMinute // Shortcut for a duration of thirty minutes DurationHour int = 60 * DurationMinute // Shortcut for a duration of an hour DurationQuarterDay int = 6 * DurationHour // Shortcut for a duration of six hours DurationHalfDay int = 12 * DurationHour // Shortcut for a duration of twelve hours DurationDay int = 24 * DurationHour // Shortcut for a duration of twenty-four hours DurationWeek int = 7 * DurationDay // Shortcut for a duration of seven days NotificationFollow string = "follow" // Type of notifications to receive through the push service NotificationMention string = "mention" // Type of notifications to receive through the push service NotificationReblog string = "reblog" // Type of notifications to receive through the push service NotificationFavourite string = "favourite" // Type of notifications to receive through the push service )
Variables ¶
This section is empty.
Functions ¶
func AddAccountsToList ¶
Adds the accounts to the list
listId: identifier of the list to be updated accounts: slice of accounts which should be added to the list
func AuthorizeFollowRequest ¶
Accepts a follower request
accountId: identifier of the account whose follow request should be accepted
func BlockDomain ¶
Blocks the given domain (strip any protocols and such, domain needs to be 'domain.tld')
domain: the domain to be blocked
func ClearNotifications ¶
Clear all notifications
func DeleteFollowSuggestion ¶
Deletes a follow suggestion
accountId: the account whose follow suggestion should be deleted
func DeleteScheduledStatus ¶
Deletes a scheduled status
scheduledId: identifier of the scheduled status to be updated
func DeleteSubscription ¶
Deletes the current subscription
func DismissNotification ¶
Dismisses a notification
notificationId: identifier of the notification to dismiss
Returns the notifications
func FocalPoint ¶
Serializes a focal point
x: x-axis focal point, between 0.0 and 1.0 y: y-axis focal point, between 0.0 and 1.0
func GetAuthorizeUrl ¶
Construct an url used to get an authorization code which can be exchanged for an access token using GetAccessTokenFromAuthorizationCode.
scope: space-separated list of scopes to be authorized for redirectUri: uri the user will be redirected to, which will have the access token attached as url param (default: urn:ietf:wg:oauth:2.0:oob)
Returns the url the user needs to open in order to get an authorization code
func GetDomainBlocks ¶
Get a page of domains the user has blocked
limit: max amount of results per page
Returns a page of domains the user has blocked and urls pointing to the previous and next page respectively
func GetUrl ¶
Gets an url (used with the prev/next urls returned by functions with pagination)
url: the url to get accessToken: the access token to authenticate the request with (optional) out: struct which should be updated with received data (optional)
Returns any errors, headers, the answer body and two urls pointing to the previous and next page respectively
func RejectFollowRequest ¶
Rejects a follower request
accountId: identifier of the account whose follow request should be rejected
func RemoveAccountsFromList ¶
Removes the accounts from the list
listId: identifier of the list to be updated accounts: slice of accounts which should be removed from the list
func Report ¶
func Report(baseUrl, accessToken, accountId string, statusIds []string, comment string, forward bool) error
Reports a user
accountId: identifier of the account to report statusIds: statuses which show violations of the ToS (optional) comment: additional information on why the user is being reported (optional, up to 1000 characters) forward: forward the report to the accounts server if it isn't the local server (default: false)
func RevokeToken ¶
Revokes an access token
func UnblockDomain ¶
Unblocks the given domain (strip any protocols and such, domain needs to be 'domain.tld')
domain: the domain to be unblocked
Types ¶
type Account ¶
type Account struct { Id string `json:"id"` // Local identifier of the account Username string `json:"username"` // Username the person signed up with (used when @-ing: @Username) Account string `json:"acct"` // Full account name (username@server.tld) or Username if the account belongs to the queried server DisplayName string `json:"display_name"` // Display Name which can be edited by the user. If empty, use Username instead Locked bool `json:"locked"` // Following a locked account will send a follow request (which has to be accepted) instead of directly following the account CreatedAt string `json:"created_at"` // The timestamp at which the account was created FollowersCount int `json:"followers_count"` // Amount of accounts following the account FollowingCount int `json:"following_count"` // Amount of accounts the account follows StatusesCount int `json:"statuses_count"` // Amount of statuses the account posted Url string `json:"url"` // URL pointing to the profile of the account Avatar string `json:"avatar"` // URL pointing to the image used as avatar by the account AvatarStatic string `json:"avatar_static"` // URL pointing to the static image used as avatar by the account Header string `json:"header"` // URL pointing to the image used as header by the account HeaderStatic string `json:"header_static"` // URL pointing to the static image used as header by the account Source Source `json:"source"` // Source data of the account Emojis []Emoji `json:"emojis"` // Custom emojis from the account Moved *Account `json:"moved"` // A reference to the original account if the account was moved Bot bool `json:"bot"` // True if the account is a bot }
An account of a user, with profile data and statistics
func GetAccountBlocks ¶
Gets a page of accounts the user has blocked.
limit: maximum amount of results per page
Returns a page of accounts the user has blocked and uris pointing to the previous and next page.
func GetAssociatedAccount ¶
Gets the account associated with the given accessToken. (This is a helper function which is not part of the API)
func GetEndorsements ¶
Gets a page of accounts the user has endorsed (endorsed accounts are highlighted on the users profile)
limit: max amount of results per page
Returns a slice of endorsed accounts and two urls pointing to the next and previous page respectively
func GetFollowRequests ¶
Returns a single page containing open follower requests
limit: maximum amount of accounts to retrieve (default: 40)
Returns a slice of accounts with a pending follow request and two urls pointing to the next and previous page respectively
func GetFolloweds ¶
func GetFolloweds(baseUrl, accessToken, accountId string, limit int) ([]Account, string, string, error)
Gets a single page of accounts followed by the given account
accountId: id of the account the followeds should be retrieved from limit: maximum amount of accounts to retrieve (default: 40)
Returns a slice of Account followed and two urls pointing to the next and previous page respectively ¶
Note that when accountId points to a local account, all followed accounts will be retrieved. If it points to a remote (federated) account, only local accounts will be retrieved.
func GetFollowers ¶
func GetFollowers(baseUrl, accessToken, accountId string, limit int) ([]Account, string, string, error)
Gets a single page of accounts following the given account
accountId: id of the account the followers should be retrieved from limit: maximum amount of accounts to retrieve (default: 40)
Returns a slice of accounts following and two urls pointing to the next and previous page respectively ¶
Note that when accountId points to a local account, all followers will be retrieved. If it points to a remote (federated) account, only local accounts will be retrieved.
func GetMutes ¶
Gets a page of muted accounts
limit: max amount of results per page (default: 40)
Returns a slice of muted accounts and two urls pointing to the next and previous url respectively
func GetStatusFavouritedBy ¶
Gets a page of accounts which favourited a status
statusId: identifier of the status limit: max amount of results per page (default: 40)
Returns a slice of accounts which favourited the status and two urls pointing to the previous and next page respectively
func GetStatusRebloggedBy ¶
Gets a page of accounts which reblogged a status
statusId: identifier of the status limit: max amount of results per page (default: 40)
Returns a slice of accounts which reblogged the status and two urls pointing to the previous and next page respectively
func ListAccounts ¶
func ListAccounts(baseUrl, accessToken, listId string, limit int) ([]Account, string, string, error)
Gets a page of accounts in a list
listId: identifier for the list to retrieve limit: max amount of results per page (default: 0)
Returns a slice of accounts and two urls pointing to the previous and next page respectively
func SearchAccounts ¶
func SearchAccounts(baseUrl, accessToken, query string, limit int, resolve, following bool) ([]Account, error)
Queries all (federated) accounts for the given query (checks username, account and display name)
query: the string to search for limit: maximum number of results per page (default: 40) resolve: attempt a webfinger lookup (default: false) following: limit the search to accounts followed (default: false)
Returns a slice of accounts matching the query
func UpdateProfile ¶
func UpdateProfile(baseUrl, accessToken, displayName, biography, locked, privacy, sensitive, language string, fields map[string]string) (Account, error)
Updates the account profile with the given values. Values set to "" (empty string) will not be updated, which allows to only update certain values.
displayName: Name shown on a users profile (does not change the username) biography: Description shown on a users profile locked: if an account is locked, following it will not immediately follow it but rather send a follow request privacy: Default privacy for statuses (public, unlisted or private) sensitive: Default sensitivity for statuses (true or false) language: Default language for posts (ISO6391, i.e. 'en') fields: Profile metadata (up to four title/value-pairs shown on a users profile)
Returns the updated account
func UpdateProfileAvatar ¶
Updates the users profile avatar.
path: path to the image which should be uploaded and used as new avatar
Returns the updated account
func UpdateProfileHeader ¶
Updates the users profile header.
path: path to the image which should be uploaded and used as new header
Returns the updated account
func VerifyAccountCredentials ¶
Verifies that the AccessToken is a valid token and associated with an account (tokens generated by authenticating using client credentials are not associated with an account and can't be used for account calls, like posting statuses, liking, reblogging, ...)
type AccountBook ¶
Book used to scroll through accounts
func GetAccountBlocksBook ¶
func GetAccountBlocksBook(baseUrl, accessToken string, limit int) AccountBook
Gets a book of accounts the user has blocked.
limit: maximum amount of results per page
Returns an AccountBook which can be used to scroll through the pages of blocked accounts.
func GetEndorsementsBook ¶
func GetEndorsementsBook(baseUrl, accessToken string, limit int) AccountBook
Gets a book which can be used to scroll through pages of accounts the user has endorsed (endorsed accounts are highlighted on the users profile)
limit: max amount of results per page
Returns an AccountBook which can be used to scroll through the pages or collect all pages at once
func GetFollowRequestsBook ¶
func GetFollowRequestsBook(baseUrl, accessToken string, limit int) AccountBook
Gets a book which can be used to scroll through pages of open follower requests
limit: maximum amount of accounts to retrieve per page (default: 40)
Returns an AccountBook which can be used to scroll through the pages or collect all pages at once
func GetFollowedsBook ¶
func GetFollowedsBook(baseUrl, accessToken, accountId string, limit int) AccountBook
Gets a book which can be used to scroll through pages of accounts followed by the given account
accountId: id of the account the followeds should be retrieved from limit: maximum amount of accounts to retrieve per page (default: 40)
Returns an AccountBook which can be used to scroll through the pages or collect all pages at once ¶
Note that when accountId points to a local account, all followed accounts will be retrieved. If it points to a remote (federated) account, only local accounts will be retrieved.
func GetFollowersBook ¶
func GetFollowersBook(baseUrl, accessToken, accountId string, limit int) AccountBook
Gets a book which can be used to scroll through pages of followers
accountId: id of the account the followers should be retrieved from limit: maximum amount of accounts to retrieve per page (default: 40)
Returns an AccountBook which can be used to scroll through the pages or collect all pages at once ¶
Note that when accountId points to a local account, all followers will be retrieved. If it points to a remote (federated) account, only local accounts will be retrieved.
func GetMutesBook ¶
func GetMutesBook(baseUrl, accessToken string, limit int) AccountBook
Gets a book used to scroll through pages of muted accounts
limit: max amount of results per page (default: 40)
Returns an AccountBook used to scroll through the pages or collect them all at once
func GetStatusFavouritedByBook ¶
func GetStatusFavouritedByBook(baseUrl, statusId string, limit int) AccountBook
Gets a book used to scroll through the pages of accounts which favourited a status
statusId: identifier of the status limit: max amount of results per page (default: 40)
Returns an AccountBook which can be used to scroll through the pages or collect all at once
func GetStatusRebloggedByBook ¶
func GetStatusRebloggedByBook(baseUrl, statusId string, limit int) AccountBook
Gets a book used to scroll through the pages of accounts which reblogged a status
statusId: identifier of the status limit: max amount of results per page (default: 40)
Returns an AccountBook which can be used to scroll through the pages or collect all at once
func ListAccountsBook ¶
func ListAccountsBook(baseUrl, accessToken, listId string, limit int) AccountBook
Gets a book used to scroll through the pages of accounts in a list
listId: identifier for the list to retrieve limit: max amount of results per page (default: 0)
Returns an AccountBook used to scroll through the pages or collect all at once
func (*AccountBook) All ¶
func (book *AccountBook) All() []Account
Returns all available accounts. Warning: Can take a long time (receives a maximum of 80 accounts per second)
func (*AccountBook) Next ¶
func (book *AccountBook) Next() []Account
Updates the book to the values from the next page
func (*AccountBook) Previous ¶
func (book *AccountBook) Previous() []Account
Updates the book to the values from the previous page
func (*AccountBook) Update ¶
func (book *AccountBook) Update(url string) []Account
Updates the book using the values retrieved from the given url
type Alerts ¶
type Alerts struct { Follow string `json:"follow"` // Notify when receiving a new follower Favourite string `json:"favourite"` // Notify when a status is favourited Reblog string `json:"reblog"` // Notify when a status is reblogged Mention string `json:"mention"` // Notify when the user is mentioned Poll string `json:"poll"` // Notify on poll updates }
Set of alerts which a subscription can be subscribed to TODO: Should be booleans, but server returns JSON strings
type App ¶
type App struct { Id string `json:"id"` // The identifier of the app ClientName string `json:"name"` // The client name as shown in statuses and applications view Website string `json:"website"` // The website which provides more information on the client RedirectUri string `json:"redirect_uri"` // The OAuth redirect endpoint ClientId string `json:"client_id"` // The OAuth ClientId ClientSecret string `json:"client_secret"` // The OAuth ClientSecret VapidKey string `json:"vapid_key"` // The associated accounts VAPID key used by WebPush }
The app retrieved when registering a client at a mastodon server
func RegisterApp ¶
Register your application as an OAuth application.
clientName: the name of the application (is shown on statuses) website: a website providing more information about your application (optional) scopes: the boundaries of scopes which can be requested redirectUri: a list of possible redirect uris (optional)
Returns an app with the application dataset (clientName, website, scope, redirectUris), clientId, clientSecret and vapidKey.
Note: the scopes set when registering the application don't actually request anything. They only specify which scopes could potentially be requested during the apps lifecycle.
func VerifyCredentials ¶
Verifies that the AccessToken is at least a valid client token (contrary to an access token associated with an account). AccessTokens that are valid can be used to authorize the client but unless they were received using an authorization method, they can't be used to post statuses, update a profile or use other methods that require an account.
See tootsuite/mastodon/app/controllers/api/v1/apps/credentials_controller.rb: https://github.com/tootsuite/mastodon/blob/master/app/controllers/api/v1/apps/credentials_controller.rb
type Application ¶
type Application struct { Name string `json:"name"` // Name of the application Website string `json:"website"` // Website of the application }
Display data of the application used to post a status
type Attachment ¶
type Attachment struct { Id string `json:"id"` // The local identifier of the attachment Type string `json:"type"` // The type of attachment (unknown, image, gifv or video) Url string `json:"url"` // Url pointing to the attachment on the server RemoteUrl string `json:"remote_url"` // Url pointing to the attachment on the original server (if the attachment was federated) PreviewUrl string `json:"preview_url"` // Url pointing to a small preview version of the attachment TextUrl string `json:"text_url"` // Url pointing to the text version of the attachment Meta Meta `json:"meta"` // Metadata of the attachment Description string `json:"description"` // A description of the attachment }
Data of an attachment which can be added to a status
func UpdateMedia ¶
func UpdateMedia(baseUrl, accessToken, attachmentId, description string, focusX, focusY float64) (Attachment, error)
Updates an existing attachment
description: description of the file (for screen readers and loading errors) (optional, max 420 characters)) focusX: x-axis focal point, between 0.0 and 1.0 (default: 0.0) focusY: y-axis focal point, between 0.0 and 1.0 (default: 0.0)
Returns the updated attachment
func UploadMedia ¶
func UploadMedia(baseUrl, accessToken, filePath, description string, focusX, focusY float64) (Attachment, error)
Uploads a new media object which can be used as attachment
filePath: path to the file which should be uploaded description: description of the file (for screen readers and loading errors) (optional, max 420 characters)) focusX: x-axis focal point, between 0.0 and 1.0 (default: 0.0) focusY: y-axis focal point, between 0.0 and 1.0 (default: 0.0)
Returns the newly created attachment
type Book ¶
type Book struct {
// contains filtered or unexported fields
}
Helper struct for pagination
func (*Book) HasPrevious ¶
Checks if the book has a link to the previous page
type Card ¶
type Card struct { Url string `json:"url"` // Url the card is pointing Title string `json:"title"` // Title of the card Description string `json:"description"` // Description of the card Image string `json:"image"` // Preview image for the url shown in the card Type string `json:"type"` // The type of card (link, photo, video or rich) AuthorName string `json:"author_name"` // Name of the author of the linked article/embeddable AuthorUrl string `json:"author_url"` // Website of the author of the linked article/embeddable ProviderName string `json:"provider_name"` // Name of the provider hosting the article/embeddable ProviderUrl string `json:"provider_url"` // Website of the provider hosting the linked article/embeddable Html string `json:"html"` // Html used when the card contains an embeddable Width float32 `json:"width"` // Width of the preview image Height float32 `json:"height"` // Height of the preview image }
Card data used to generate a preview/embedding for links in statuses
func GetStatusCard ¶
Gets the card of a status
statusId: identifier of the status whose card to get
Returns the card
type Context ¶
type Context struct { Ancestors []Status `json:"ancestors"` // Statuses preceding this status Descendants []Status `json:"descendants"` // Statuses following a status }
The context of a status, used in conversations
func GetStatusContext ¶
Gets the context of a status
statusId: identifier of the status whose context to get
Returns the context
type Conversation ¶
type Conversation struct { Id string `json:"id"` // Identifier of this conversation Accounts []Account `json:"accounts"` // Accounts participating in the conversation LastStatus Status `json:"last_status"` // The status which was posted last Unread bool `json:"unread"` // True if the conversation has unread statuses }
Data of a conversation
func GetConversations ¶
func GetConversations(baseUrl, accessToken, maxId, sinceId, minId string, limit int) ([]Conversation, string, string, error)
Gets a page of conversations
maxId: only retrieve conversations with statuses before this status (optional) sinceId: only retrieve conversations with statuses after this status (optional) minId: only retrieve conversations with statuses after this status (optional) limit: only retrieve this amount of statuses per page (default: 40)
Returns a slice of conversations and two urls pointing to the previous and next page respectively
type ConversationBook ¶
type ConversationBook struct { Current []Conversation Book }
Book used to scroll through statuses
func GetConversationsBook ¶
func GetConversationsBook(baseUrl, accessToken string, limit int) ConversationBook
Gets a book used to scroll through the pages of conversations
limit: only retrieve this amount of statuses per page (default: 40)
Returns a ConversationBook used to scroll through the pages or collect them all at once
func NewConversationBook ¶
func NewConversationBook(accessToken string) ConversationBook
Creates a new ConversationBook
func (*ConversationBook) All ¶
func (book *ConversationBook) All() []Conversation
Returns all available statuses. Warning: Can take a long time (receives a maximum of 80 accounts per second)
func (*ConversationBook) Get ¶
func (book *ConversationBook) Get(url, accessToken string) ([]Conversation, string, string, error)
Retrieves the page of data and link-urls from the given url
func (*ConversationBook) Next ¶
func (book *ConversationBook) Next() []Conversation
Updates the book to the values from the next page
func (*ConversationBook) Previous ¶
func (book *ConversationBook) Previous() []Conversation
Updates the book to the values from the previous page
func (*ConversationBook) Update ¶
func (book *ConversationBook) Update(url string) []Conversation
Updates the book using the values retrieved from the given url
type Emoji ¶
type Emoji struct { ShortCode string `json:"shortcode"` // ShortCode of the emoji (used when 'writing' emojis, i.e. ':+1:' of which '+1' is the ShortCode of the thumbs-up emoji) StaticUrl string `json:"static_url"` // Url pointing to the static image of the emoji Url string `json:"url"` // Url pointing to the image of the emoji VisibleInPicker bool `json:"visible_in_picker"` // True if the emoji should be visible in pickers }
Data used for custom emojis
type Error ¶
type Error struct {
Error string `json:"error"` // Contains the error
}
Data sent by the server to provide information why an action/request failed
type Field ¶
type Field struct { Name string `json:"name"` // The name of the field, shown on the left side Value string `json:"value"` // The value of the field, shown on the right side VerifiedAt string `json:"verified_at"` // Timestamp of when the field was verified (or empty if not verified) }
A field shown on a users profile (up to four fields can be set)
type Filter ¶
type Filter struct { Id string `json:"id"` // Identifier of the filter Phrase string `json:"phrase"` // Phrase that is filtered Context []string `json:"context"` // Context the filter should be applied in (one or more of home, notifications, public and/or thread) ExpiresAt string `json:"expires_at"` // Timestamp at which the filter expires Irreversible bool `json:"irreversible"` // If the filter is irreversible, the filtered content will be deleted from the personal view instead of hidden. Therefore it can't be shown even if the filter is deleted or timed out. WholeWord bool `json:"whole_word"` // True if the filter needs to match a whole word instead of matching anything }
Data for a filter used to automatically hide statuses from users
func CreateFilter ¶
func CreateFilter(baseUrl, accessToken, phrase string, context []string, irreversible, wholeWord bool, expiresIn int) (Filter, error)
Creates a new filter
phrase: the phrase to be checked for in statuses context: the context(s) in which the filter should be applied (one or more of home, notifications, public and/or thread) irreversible: if true, matching statuses will be dropped from the timeline instead of hidden (only works with context home and notifications) (default: false) wholeWord: whether to consider word boundaries when matching (default: false) expiresIn: time in seconds when the filter will expire or no-expiration when set to 0 (default: 0)
Returns the newly created filter
func GetFilter ¶
Get a specific filter
filterId: identifier of the filter to be retrieved
Returns the filter for the given id
func UpdateFilter ¶
func UpdateFilter(baseUrl, accessToken, filterId, phrase string, context []string, irreversible, wholeWord bool, expiresIn int) (Filter, error)
Updates an existing filter
phrase: the phrase to be checked for in statuses context: the context(s) in which the filter should be applied (one or more of home, notifications, public and/or thread) irreversible: if true, matching statuses will be dropped from the timeline instead of hidden (only works with context home and notifications) (default: false) wholeWord: whether to consider word boundaries when matching (default: false) expiresIn: time in seconds when the filter will expire or no-expiration when set to 0 (default: 0)
Returns the updated filter
type Focus ¶
type Focus struct { X float32 `json:"x"` // X-Axis focal point of an attachment (between 0.0 and 1.0) Y float32 `json:"y"` // Y-Axis focal point of an attachment (between 0.0 and 1.0) }
Focus data of an image, used to align the preview image
type History ¶
type History struct { Day string `json:"day"` // Timestamp of the date this entry is referring to Uses string `json:"uses"` // Times the (hash) tag has been used at that day Accounts string `json:"accounts"` // Amount of different accounts who used the (hash) tag }
A dated statistic of the uses for a (hash) tag
type Instance ¶
type Instance struct { Uri string `json:"uri"` // Uri of the mastodon instance Title string `json:"title"` // Title of the mastodon instance Description string `json:"description"` // Description of the mastodon instance Email string `json:"email"` // Public contact email of the mastodon instance Version string `json:"version"` // Version of the mastodon instance Thumbnail string `json:"thumbnail"` // Url pointing to the thumbnail (preview) image of the mastodon instance Urls URLs `json:"urls"` // Url pointing to the streaming api endpoint (Used by WebSockets) Stats Stats `json:"stats"` // Statistics of the mastodon instance Languages []string `json:"languages"` // Official languages of the mastodon instance ContactAccount Account `json:"contact_account"` // Administrator/official contact of the mastodon instance }
Data used to provide information about a mastodon server
type List ¶
type List struct { Id string `json:"id"` // Identifier for the list Title string `json:"title"` // Title of the list }
Lists allow the creation of timelines which only contains statuses by a specified set of accounts
func GetList ¶
Get a single list created by the user
listId: identifier of the list to retrieve
Returns a list
func GetListsWithAccount ¶
Get all lists containing an account
accountId: identifier for an account the lists should be queried for
Returns a slice of lists containing the account
func UpdateList ¶
Updates a list
listId: identifier of the list to be updated title: the new title of the list
Returns the updated list
type Media ¶
type Media struct { Path string // Path to the media file Description string // A description of the media (optional) FocusX float64 // The x-axis focus point (between 0.0 and 1.0) FocusY float64 // The y-axis focus point (between 0.0 and 1.0) }
A struct used when uploading media attachments within the status post call
type Mention ¶
type Mention struct { Url string `json:"url"` // Url pointing to the url of the mentioned account Username string `json:"username"` // Username of the mentioned account Account string `json:"acct"` // Full account name (username@server.tld) or Username if the account belongs to the queried server Id string `json:"id"` // Identifier of the mentioned account }
Data of a mentioned account
type Meta ¶
type Meta struct { Focus Focus `json:"focus"` // Focus point of an attachment Small MetaAttributes `json:"small"` // Set of attributes for the small (preview) version of an attachment Original MetaAttributes `json:"original"` // Set of attributes for the original version of an attachment }
Metadata of an attachment
type MetaAttributes ¶
type MetaAttributes struct { Width float32 `json:"width"` // Width of an attachment Height float32 `json:"height"` // Height of an attachment Size string `json:"size"` // Size of an image attachment Aspect float32 `json:"aspect"` // Aspect ratio of an image attachment FrameRate string `json:"frame_rate"` // Framerate of a gifv/video attachment Duration float32 `json:"duration"` // Duration of a gifv/video attachment Bitrate float32 `json:"bitrate"` // Bitrate of a gifv/video attachment }
Metadata of an attachment
type Notification ¶
type Notification struct { Id string `json:"id"` // Identifier for the notification Type string `json:"type"` // Type of notification (follow, mention, reblog or favourite) CreatedAt string `json:"created_at"` // Timestamp of when the notification was generated Account Account `json:"account"` // The account which performed an action (followed, mentioned, reblogged or favourited) Status Status `json:"status"` // The status which an action was performed on/with }
Data of a notification
func GetNotification ¶
func GetNotification(baseUrl, accessToken, notificationId string) (Notification, error)
Get a notification
notificationId: identifier of the notification to get
Returns the notifications
func GetNotifications ¶
func GetNotifications(baseUrl, accessToken string, excludeTypes []string, accountId, maxId, sinceId, minId string, limit int) ([]Notification, string, string, error)
Gets a page of notifications
excludeTypes: types to exclude (one or more of follow, favourite, reblog and/or mention) accountId: return notifications which were created due to actions performed by this account (optional) maxId: only retrieve statuses before this status (optional) sinceId: only retrieve statuses after this status (optional) minId: only retrieve statuses after this status (optional) limit: max amount of results per page (default: 20)
Returns a slice of notifications and two urls pointing to the previous and next url respectively
type NotificationBook ¶
type NotificationBook struct { Current []Notification Book }
Book used to scroll through statuses
func GetNotificationsBook ¶
func GetNotificationsBook(baseUrl, accessToken string, excludeTypes []string, accountId string, limit int) NotificationBook
Gets a book used to scroll through pages of notifications
excludeTypes: types to exclude (one or more of follow, favourite, reblog and/or mention) accountId: return notifications which were created due to actions performed by this account (optional) limit: max amount of results per page (default: 20)
Returns a NotificationBook used to scroll through the pages or collect all at once
func NewNotificationBook ¶
func NewNotificationBook(accessToken string) NotificationBook
Creates a new NotificationBook
func (*NotificationBook) All ¶
func (book *NotificationBook) All() []Notification
Returns all available statuses. Warning: Can take a long time (receives a maximum of 80 accounts per second)
func (*NotificationBook) Get ¶
func (book *NotificationBook) Get(url, accessToken string) ([]Notification, string, string, error)
Retrieves the page of data and link-urls from the given url
func (*NotificationBook) Next ¶
func (book *NotificationBook) Next() []Notification
Updates the book to the values from the next page
func (*NotificationBook) Previous ¶
func (book *NotificationBook) Previous() []Notification
Updates the book to the values from the previous page
func (*NotificationBook) Update ¶
func (book *NotificationBook) Update(url string) []Notification
Updates the book using the values retrieved from the given url
type Poll ¶
type Poll struct { Id string `json:"id"` // Identifier of the poll ExpiresAt string `json:"expires_at"` // Timestamp of when the poll will expire/expired at Expired bool `json:"expired"` // True if the poll already expired Multiple bool `json:"multiple"` // True if the poll allows multiple-choice answers VotesCount int `json:"votes_count"` // Amount of votes already posted (counts multiple-choice answers as multiple votes) Options []PollOption `json:"options"` // Options to choose from Voted bool `json:"voted"` // True if the user already voted on this poll }
Data of a poll
func VoteOnPoll ¶
Posts a vote on a poll
pollId: identifier of the poll to vote on choices: one (or more) ordinals of choices to vote on (multiple ordinals can only be used when the vote allows multiple choices)
Returns the updated poll
type PollOption ¶
type PollOption struct { Title string `json:"title"` // Title of the choice VotesCount int `json:"votes_count"` // Amount of votes for the choice }
Data for a single choice in a poll
type PushSubscription ¶
type PushSubscription struct { Id int64 `json:"id"` // Identifier of the subscription Endpoint string `json:"endpoint"` // Endpoint of the subscription ServerKey string `json:"server_key"` // ServerKey used for the subscription Alerts Alerts `json:"alerts"` // Alerts which are subscribed to }
Data for the push subscription
func CreateSubscription ¶
func CreateSubscription(baseUrl, accessToken, endpoint, p256dh, auth string, follow, favourite, reblog, mention, poll bool) (PushSubscription, error)
Creates a new subscription
endpoint: url of the push endpoint p256dh: public key (Base64 encoded string of public key of ECDH key using ‘prime256v1’ curve) auth: auth secret (Base64 encoded string of 16 bytes of random data) follow: receive follow notifications favourite: receive favourite notifications reblog: receive reblog notifications mention: receive mention notifications poll: receive poll notifications
Returns the newly created push subscription
func GetSubscription ¶
func GetSubscription(baseUrl, accessToken string) (PushSubscription, error)
Gets the current subscription
func UpdateSubscription ¶
func UpdateSubscription(baseUrl, accessToken string, follow, favourite, reblog, mention, poll bool) (PushSubscription, error)
Updates the subscription
follow: receive follow notifications favourite: receive favourite notifications reblog: receive reblog notifications mention: receive mention notifications poll: receive poll notifications
Returns the updated push subscription
type Relationship ¶
type Relationship struct { Id string `json:"id"` // Identifier of the account Following bool `json:"following"` // True if the user follows the account FollowedBy bool `json:"followed_by"` // True if the account follows the user Blocking bool `json:"blocking"` // True if the user blocks the account Muting bool `json:"muting"` // True if the user muted the account MutingNotifications bool `json:"muting_notifications"` // True if the user muted notifications for the account Requested bool `json:"requested"` // True if the user sent a follow request to the account DomainBlocking bool `json:"domain_blocking"` // True if the account is on a blocked domain ShowingReblogs bool `json:"showing_reblogs"` // True if the user wants to see reblogs by the account Endorsed bool `json:"endorsed"` // True if the user endorsed the account }
Relationship data between two accounts
func BlockAccount ¶
func BlockAccount(baseUrl, accessToken, accountId string) (Relationship, error)
Blocks the given account.
accountId: the accountId associated with the account to be blocked
Returns the updated relationship
func EndorseAccount ¶
func EndorseAccount(baseUrl, accessToken, accountId string) (Relationship, error)
Endorses (pins) the given account
accountId: the account to endorse
Returns the updated relationship
func FollowAccount ¶
func FollowAccount(baseUrl, accessToken, accountId string, hideReblogs string) (Relationship, error)
Follow the given account.
hideReblogs: show/hide reblogs in timelines and such (default: false)
Returns the new relationship
func GetRelationships ¶
func GetRelationships(baseUrl, accessToken string, accountIds ...string) ([]Relationship, error)
Get the relationship to all given accounts
accountIds: Slice of accounts to return
Returns an slice containing a relationship for each given accountId
func MuteAccount ¶
func MuteAccount(baseUrl, accessToken, accountId string, notifications bool) (Relationship, error)
Mutes an account
accountId: identifier of the account to be muted
notifications: if notifications for this account should be muted as well (default: true)
Returns the updated relationship
func UnblockAccount ¶
func UnblockAccount(baseUrl, accessToken, accountId string) (Relationship, error)
Unblocks the given account
accountId: the accountId associated with the account to be blocked
Returns the updated relationship
func UnendorseAccount ¶
func UnendorseAccount(baseUrl, accessToken, accountId string) (Relationship, error)
Unendorses (unpins) the given account
accountId: the account to unendorse
Returns the updated relationship
func UnfollowAccount ¶
func UnfollowAccount(baseUrl, accessToken, accountId string) (Relationship, error)
Unfollow the given account.
Returns the new relationship
func UnmuteAccount ¶
func UnmuteAccount(baseUrl, accessToken, accountId string) (Relationship, error)
Unmutes an account
accountId: identifier of the account to be unmuted
Returns the updated relationship
type Result ¶
type Result struct { Accounts []Account `json:"accounts"` // Accounts matching the query Statuses []Status `json:"statuses"` // Statuses matching the query }
Set of search results
func Search ¶
func Search(baseUrl, accessToken, query string, resolve, following bool, limit, offset int) (Result, error)
Search accounts, statuses and tags
query: query to look for resolve: attempt a WebFinger lookup (default: false) following: only include accounts the user is following (default: false) limit: max number of results (default: 40) offset: result offset of the search (used for pagination) (default: 0)
Returns a result, containing individual slices for accounts, statuses and tags
type ScheduledStatus ¶
type ScheduledStatus struct { Id string `json:"id"` // Identifier for the scheduled status ScheduledAt string `json:"scheduled_at"` // Timestamp at which the status will be posted Params StatusParams `json:"params"` // Parameters of the status which will be posted MediaAttachments []Attachment `json:"media_attachments"` // Attachments of the status which will be posted }
Data of a scheduled status
func GetScheduledStatus ¶
func GetScheduledStatus(baseUrl, accessToken, scheduledId string) (ScheduledStatus, error)
Gets a scheduled status
scheduledId: identifier of the scheduled status to get
Returns the scheduled status
func GetScheduledStatuses ¶
func GetScheduledStatuses(baseUrl, accessToken string) ([]ScheduledStatus, error)
Get all scheduled statuses
Returns a slice of scheduled statuses
func ScheduleMediaStatus ¶
func ScheduleMediaStatus(baseUrl, accessToken, status, scheduledAt, inReplyToId string, mediaIds []string, sensitive bool, spoilerText, visibility, language, idempotencyKey string) (ScheduledStatus, error)
Schedules a new media status
status: the text of the status scheduledAt: timestamp of when the status will be posted inReplyToId: identifier of the status it will reply to (optional) mediaIds: identifiers of attachments (media status) sensitive: set to true if the post contains sensitive content (default: false) spoilerText: text which will be shown instead if the status is marked as sensitive (optional) visibility: visibility of the status (either public, private, unlisted or direct) (default: public) language: the language of the status (ISO 8601) (optional) idempotencyKey: helps preventing duplicate posts (optional)
Returns the newly scheduled status
func SchedulePollStatus ¶
func SchedulePollStatus(baseUrl, accessToken, status, scheduledAt, inReplyToId string, pollOptions []string, pollExpiresIn int, pollMultiple, pollHideTotals, sensitive bool, spoilerText, visibility, language, idempotencyKey string) (ScheduledStatus, error)
Schedules a new poll
status: the text of the status scheduledAt: timestamp of when the status will be posted inReplyToId: identifier of the status it will reply to (optional) pollOptions: options for the poll (poll status) pollExpiresIn: time in seconds the poll will be live (poll status) (default: DurationDay) pollMultiple: set to true to allow multiple choices (poll status) (default: false) pollHideTotals: set to true to hide the results while the poll is live (poll status) (default: false) sensitive: set to true if the post contains sensitive content (default: false) spoilerText: text which will be shown instead if the status is marked as sensitive (optional) visibility: visibility of the status (either public, private, unlisted or direct) (default: public) language: the language of the status (ISO 8601) (optional) idempotencyKey: helps preventing duplicate posts (optional)
Returns the newly scheduled status
func ScheduleStatus ¶
func ScheduleStatus(baseUrl, accessToken, status, scheduledAt, inReplyToId string, mediaIds []string, pollOptions []string, pollExpiresIn int, pollMultiple, pollHideTotals, sensitive bool, spoilerText, visibility, language, idempotencyKey string) (ScheduledStatus, error)
Schedules a new status
status: the text of the status scheduledAt: timestamp of when the status will be posted inReplyToId: identifier of the status it will reply to (optional) mediaIds: identifiers of attachments (media status) pollOptions: options for the poll (poll status) pollExpiresIn: time in seconds the poll will be live (poll status) (default: DurationDay) pollMultiple: set to true to allow multiple choices (poll status) (default: false) pollHideTotals: set to true to hide the results while the poll is live (poll status) (default: false) sensitive: set to true if the post contains sensitive content (default: false) spoilerText: text which will be shown instead if the status is marked as sensitive (optional) visibility: visibility of the status (either public, private, unlisted or direct) (default: public) language: the language of the status (ISO 8601) (optional) idempotencyKey: helps preventing duplicate posts (optional)
Returns the newly scheduled status
func ScheduleTextStatus ¶
func ScheduleTextStatus(baseUrl, accessToken, status, scheduledAt, inReplyToId string, sensitive bool, spoilerText, visibility, language, idempotencyKey string) (ScheduledStatus, error)
Schedules a new text status
status: the text of the status scheduledAt: timestamp of when the status will be posted inReplyToId: identifier of the status it will reply to (optional) sensitive: set to true if the post contains sensitive content (default: false) spoilerText: text which will be shown instead if the status is marked as sensitive (optional) visibility: visibility of the status (either public, private, unlisted or direct) (default: public) language: the language of the status (ISO 8601) (optional) idempotencyKey: helps preventing duplicate posts (optional)
Returns the newly scheduled status
func UpdateScheduledStatus ¶
func UpdateScheduledStatus(baseUrl, accessToken, scheduledId, scheduledAt string) (ScheduledStatus, error)
Moves a scheduled status to a new time
scheduledId: identifier of the scheduled status to be updated scheduledAt: timestamp of when the status should be scheduled
Returns the updated scheduled status
func UploadAndScheduleMediaStatus ¶
func UploadAndScheduleMediaStatus(baseUrl, accessToken, status, scheduledAt, inReplyToId string, medias []Media, sensitive bool, spoilerText, visibility, language, idempotencyKey string) (ScheduledStatus, error)
Uploads any attachments and schedules a new media status
status: the text of the status scheduledAt: timestamp of when the status will be posted inReplyToId: identifier of the status it will reply to (optional) medias: slice of medias which should be uploaded and attached (optional) sensitive: set to true if the post contains sensitive content (default: false) spoilerText: text which will be shown instead if the status is marked as sensitive (optional) visibility: visibility of the status (either public, private, unlisted or direct) (default: public) language: the language of the status (ISO 8601) (optional) idempotencyKey: helps preventing duplicate posts (optional)
Returns the newly scheduled status
type Source ¶
type Source struct { Privacy string `json:"privacy"` // The default set visibility of statuses (public, private, unlisted, direct) Sensitive bool `json:"sensitive"` // The default sensitivity setting of statuses Language string `json:"language"` // The default language of statuses Note string `json:"note"` // Description/Biography of the account Fields []Field `json:"fields"` // Array of up to four fields shown on the profile }
Source data of an account
type Stats ¶
type Stats struct { UserCount int64 `json:"user_count"` // Amount of users registered at the mastodon instance StatusCount int64 `json:"status_count"` // Amount of statuses posted by members of the mastodon instance DomainCount int64 `json:"domain_count"` // Amount of domains federated on the mastodon instance }
Statistics for a mastodon server
type Status ¶
type Status struct { Id string `json:"id"` // Identifier for the status Uri string `json:"uri"` // Uri pointing to the status Url string `json:"url"` // Url pointing to the status Account Account `json:"account"` // Account which posted the status InReplyToId string `json:"in_reply_to_id"` // Identifier of the status replied to InReplyToAccountId string `json:"in_reply_to_account_id"` // Identifier of the account replied to Reblog *Status `json:"reblog"` // Status which was reblogged Content string `json:"content"` // Content of the status CreatedAt string `json:"created_at"` // Timestamp of when the status was created Emojis []Emoji `json:"emojis"` // Set of emojis used in the status RepliesCount int `json:"replies_count"` // Amount of replies given to the status ReblogsCount int `json:"reblogs_count"` // Amount of times the status was reblogged FavouritesCount int `json:"favourites_count"` // Amount of favourites the status received Reblogged bool `json:"reblogged"` // True if the user reblogged the status Favourited bool `json:"favourited"` // True if the user favourited the status Muted bool `json:"muted"` // True if the user muted the status Sensitive bool `json:"sensitive"` // True if the content of the status should be marked sensitive SpoilerText string `json:"spoiler_text"` // Text shown if the status is sensitive Visibility string `json:"visibility"` // Visibility of the status (public, private, unlisted or direct) MediaAttachments []Attachment `json:"media_attachments"` // Attachments of the status Mentions []Mention `json:"mentions"` // Other accounts mentioned in the status Tags []Tag `json:"tags"` // Tags in the status Card Card `json:"card"` // Card data of the status Poll Poll `json:"poll"` // Poll data of the status Application Application `json:"application"` // Application which posted the status Language string `json:"language"` // Language of the content Pinned bool `json:"pinned"` // True if the status is pinned }
Data of a status
func FavouriteStatus ¶
Favourites a status
statusId: identifier of the status which should be favourited
Returns the status
func GetFavourites ¶
Gets a single page of statuses favourited by the user
limit: maximum amount of accounts to retrieve (default: 40)
Returns a slice of favourited statuses and two urls pointing to the next and previous page respectively
func GetHashtagTimeline ¶
func GetHashtagTimeline(baseUrl, accessToken, hashTag string, local, onlyMedia bool, maxId, sinceId, minId string, limit int) ([]Status, string, string, error)
Gets a page of statuses in a hashtags timeline
hashTag: the hashtag whose timeline to retrieve local: only retrieve local statuses (default: false) onlyMedia: only retrieve statuses with attachments (default: false) maxId: only retrieve statuses before this status (optional) sinceId: only retrieve statuses after this status (optional) minId: only retrieve statuses after this status (optional) limit: only retrieve this amount of statuses per page (default: 40)
Returns a slice of statuses and two urls pointing to the previous and next page respectively
func GetHomeTimeline ¶
func GetHomeTimeline(baseUrl, accessToken, maxId, sinceId, minId string, limit int) ([]Status, string, string, error)
Gets a page of statuses in the home timeline
maxId: only retrieve statuses before this status (optional) sinceId: only retrieve statuses after this status (optional) minId: only retrieve statuses after this status (optional) limit: only retrieve this amount of statuses per page (default: 40)
Returns a slice of statuses and two urls pointing to the previous and next page respectively
func GetListTimeline ¶
func GetListTimeline(baseUrl, accessToken, listId, maxId, sinceId, minId string, limit int) ([]Status, string, string, error)
Gets a page of statuses in a lists timeline
listId: identifier of the list whose timeline to retrieve maxId: only retrieve statuses before this status (optional) sinceId: only retrieve statuses after this status (optional) minId: only retrieve statuses after this status (optional) limit: only retrieve this amount of statuses per page (default: 40)
Returns a slice of statuses and two urls pointing to the previous and next page respectively
func GetPublicTimeline ¶
func GetPublicTimeline(baseUrl, accessToken string, local, onlyMedia bool, maxId, sinceId, minId string, limit int) ([]Status, string, string, error)
Gets a page of statuses in the public timeline
local: only retrieve local statuses (default: false) onlyMedia: only retrieve statuses with attachments (default: false) maxId: only retrieve statuses before this status (optional) sinceId: only retrieve statuses after this status (optional) minId: only retrieve statuses after this status (optional) limit: only retrieve this amount of statuses per page (default: 40)
Returns a slice of statuses and two urls pointing to the previous and next page respectively
func GetStatusesOfAccount ¶
func GetStatusesOfAccount(baseUrl, accessToken, accountId string, onlyMedia, onlyPinned, excludeReplies, excludeReblogs bool, maxId, sinceId, minId string, limit int) ([]Status, string, string, error)
Gets a page of statuses (visible to the user) posted by the given account.
onlyMedia: only retrieve statuses which include media (default: false) onlyPinned: only retrieve statuses which are pinned (default: false) excludeReplies: exclude statuses which reply to other statuses (default: false) excludeReblogs: exclude reblogs (default: false) maxId: only retrieve statuses before this status (optional) sinceId: only retrieve statuses after this status (optional) minId: only retrieve statuses after this status (optional) limit: only retrieve this amount of statuses per page (default: 40)
Returns a slice of statuses and two urls pointing to the next and previous page respectively ¶
Note that when AccountId points to a local account, all statuses will be retrieved. If it points to a remote (federated) account, only statuses posted after it first appeared to the server will be retrieved.
func PostMediaStatus ¶
func PostMediaStatus(baseUrl, accessToken, status, inReplyToId string, mediaIds []string, sensitive bool, spoilerText, visibility, language, idempotencyKey string) (Status, error)
Posts a new media status
status: the text of the status inReplyToId: identifier of the status it will reply to (optional) mediaIds: identifiers of attachments (media status) sensitive: set to true if the post contains sensitive content (default: false) spoilerText: text which will be shown instead if the status is marked as sensitive (optional) visibility: visibility of the status (either public, private, unlisted or direct) (default: public) language: the language of the status (ISO 8601) (optional) idempotencyKey: helps preventing duplicate posts (optional)
Returns the newly posted status
func PostPollStatus ¶
func PostPollStatus(baseUrl, accessToken, status, inReplyToId string, pollOptions []string, pollExpiresIn int, pollMultiple, pollHideTotals, sensitive bool, spoilerText, visibility, language, idempotencyKey string) (Status, error)
Posts a new poll
status: the text of the status inReplyToId: identifier of the status it will reply to (optional) pollOptions: options for the poll (poll status) pollExpiresIn: time in seconds the poll will be live (poll status) (default: DurationDay) pollMultiple: set to true to allow multiple choices (poll status) (default: false) pollHideTotals: set to true to hide the results while the poll is live (poll status) (default: false) sensitive: set to true if the post contains sensitive content (default: false) spoilerText: text which will be shown instead if the status is marked as sensitive (optional) visibility: visibility of the status (either public, private, unlisted or direct) (default: public) language: the language of the status (ISO 8601) (optional) idempotencyKey: helps preventing duplicate posts (optional)
Returns the newly posted status
func PostStatus ¶
func PostStatus(baseUrl, accessToken, status, inReplyToId string, mediaIds []string, pollOptions []string, pollExpiresIn int, pollMultiple, pollHideTotals, sensitive bool, spoilerText, visibility, language, idempotencyKey string) (Status, error)
Posts a new status
status: the text of the status inReplyToId: identifier of the status it will reply to (optional) mediaIds: identifiers of attachments (media status) pollOptions: options for the poll (poll status) pollExpiresIn: time in seconds the poll will be live (poll status) (default: DurationDay) pollMultiple: set to true to allow multiple choices (poll status) (default: false) pollHideTotals: set to true to hide the results while the poll is live (poll status) (default: false) sensitive: set to true if the post contains sensitive content (default: false) spoilerText: text which will be shown instead if the status is marked as sensitive (optional) visibility: visibility of the status (either public, private, unlisted or direct) (default: public) language: the language of the status (ISO 8601) (optional) idempotencyKey: helps preventing duplicate posts (optional)
Returns the newly posted status
func PostTextStatus ¶
func PostTextStatus(baseUrl, accessToken, status, inReplyToId string, sensitive bool, spoilerText, visibility, language, idempotencyKey string) (Status, error)
Posts a new text status
status: the text of the status inReplyToId: identifier of the status it will reply to (optional) sensitive: set to true if the post contains sensitive content (default: false) spoilerText: text which will be shown instead if the status is marked as sensitive (optional) visibility: visibility of the status (either public, private, unlisted or direct) (default: public) language: the language of the status (ISO 8601) (optional) idempotencyKey: helps preventing duplicate posts (optional)
Returns the newly posted status
func UnfavouriteStatus ¶
Unfavourites a status
statusId: identifier of the status which should be unfavourited
Returns the status
func UnmuteStatus ¶
Unmutes a status
statusId: identifier of the status to be unmuted
Returns the status
func UploadAndPostMediaStatus ¶
func UploadAndPostMediaStatus(baseUrl, accessToken, status, inReplyToId string, medias []Media, sensitive bool, spoilerText, visibility, language, idempotencyKey string) (Status, error)
Uploads any attachments and posts a new media status
status: the text of the status inReplyToId: identifier of the status it will reply to (optional) mediaIds: identifiers of attachments (media status) sensitive: set to true if the post contains sensitive content (default: false) spoilerText: text which will be shown instead if the status is marked as sensitive (optional) visibility: visibility of the status (either public, private, unlisted or direct) (default: public) language: the language of the status (ISO 8601) (optional) idempotencyKey: helps preventing duplicate posts (optional)
Returns the newly posted status
type StatusBook ¶
Book used to scroll through statuses
func GetFavouritesBook ¶
func GetFavouritesBook(baseUrl, accessToken string, limit int) StatusBook
Gets a book which can be used to scroll through pages of statuses favourited by the user
limit: maximum amount of accounts to retrieve per page (default: 40)
Returns a StatusBook which can be used to scroll through the pages or collect all pages at once
func GetHashtagTimelineBook ¶
func GetHashtagTimelineBook(baseUrl, accessToken, hashTag string, local, onlyMedia bool, limit int) StatusBook
Gets a book used to scroll through the pages of statuses in a hashtags timeline
hashTag: the hashtag whose timeline to retrieve local: only retrieve local statuses (default: false) onlyMedia: only retrieve statuses with attachments (default: false) limit: only retrieve this amount of statuses per page (default: 40)
Returns a StatusBook used to scroll through the pages or collect them all at once
func GetHomeTimelineBook ¶
func GetHomeTimelineBook(baseUrl, accessToken string, limit int) StatusBook
Gets a book used to scroll through the pages of statuses in the home timeline
limit: only retrieve this amount of statuses per page (default: 40)
Returns a StatusBook used to scroll through the pages or collect them all at once
func GetListTimelineBook ¶
func GetListTimelineBook(baseUrl, accessToken, listId string, limit int) StatusBook
Gets a book used to scroll through the pages of statuses in a lists timeline
listId: identifier of the list whose timeline to retrieve limit: only retrieve this amount of statuses per page (default: 40)
Returns a StatusBook used to scroll through the pages or collect them all at once
func GetPublicTimelineBook ¶
func GetPublicTimelineBook(baseUrl, accessToken string, local, onlyMedia bool, limit int) StatusBook
Gets a book used to scroll through the pages of statuses in the public timeline
local: only retrieve local statuses (default: false) onlyMedia: only retrieve statuses with attachments (default: false) limit: only retrieve this amount of statuses per page (default: 40)
Returns a StatusBook used to scroll through the pages or collect them all at once
func GetStatusesOfAccountBook ¶
func GetStatusesOfAccountBook(baseUrl, accessToken, accountId string, onlyMedia, onlyPinned, excludeReplies, excludeReblogs bool, limit int) StatusBook
Gets a book which can be used to scroll through pages of statuses (visible to the user) posted by the given account.
onlyMedia: only retrieve statuses which include media (default: false) onlyPinned: only retrieve statuses which are pinned (default: false) excludeReplies: exclude statuses which reply to other statuses (default: false) excludeReblogs: exclude reblogs (default: false) limit: only retrieve this amount of statuses per page (default: 40)
Returns an StatusBook which can be used to scroll through the pages or collect all pages at once ¶
Note that when accountId points to a local account, all statuses will be retrieved. If it points to a remote (federated) account, only statuses posted after it first appeared to the server will be retrieved.
func (*StatusBook) All ¶
func (book *StatusBook) All() []Status
Returns all available statuses. Warning: Can take a long time (receives a maximum of 80 accounts per second)
func (*StatusBook) Next ¶
func (book *StatusBook) Next() []Status
Updates the book to the values from the next page
func (*StatusBook) Previous ¶
func (book *StatusBook) Previous() []Status
Updates the book to the values from the previous page
func (*StatusBook) Update ¶
func (book *StatusBook) Update(url string) []Status
Updates the book using the values retrieved from the given url
type StatusParams ¶
type StatusParams struct { Text string `json:"text"` // Content of the status InReplyToId string `json:"in_reply_to_id"` // Identifier of the status it replies to MediaIds []string `json:"media_ids"` // Identifiers of the attachments added to the status Sensitive string `json:"sensitive"` // True if the status will be sensitive SpoilerText string `json:"spoiler_text"` // Text shown if the status is sensitive Visibility string `json:"visibility"` // Visibility of the status (public, private, unlisted or direct) ScheduledAt string `json:"scheduled_at"` // Timestamp at which the status will be posted ApplicationId int64 `json:"application_id"` // Identifier of the application which scheduled the status }
Data of a status that is yet to be posted
type StringBook ¶
Book used to scroll through statuses
func GetDomainBlocksBook ¶
func GetDomainBlocksBook(baseUrl, accessToken string, limit int) StringBook
Gets a book which can be used to scroll through pages of domains the user has blocked
limit: max amount of results per page
Returns a StringBook which can be used to scroll through the pages or collect all pages at once
func (*StringBook) All ¶
func (book *StringBook) All() []string
Returns all available statuses. Warning: Can take a long time (receives a maximum of 80 accounts per second)
func (*StringBook) Next ¶
func (book *StringBook) Next() []string
Updates the book to the values from the next page
func (*StringBook) Previous ¶
func (book *StringBook) Previous() []string
Updates the book to the values from the previous page
func (*StringBook) Update ¶
func (book *StringBook) Update(url string) []string
Updates the book using the values retrieved from the given url
type Tag ¶
type Tag struct { Name string `json:"name"` // Name of the (hash) tag Url string `json:"url"` // Url pointing to a timeline of statuses containing the (hash) tag History []History `json:"history"` // Historic data of uses for the (hash) tag }
Data of a (hash) tag
type Token ¶
type Token struct { AccessToken string `json:"access_token"` // The OAuth access token TokenType string `json:"token_type"` // The type of token (normally Bearer) Scope string `json:"scope"` // Scope of the token CreatedAt int64 `json:"created_at"` // Timestamp of when the token was generated }
Token data retrieved when authorizing a client
func CreateAccount ¶
func CreateAccount(baseUrl, accessToken, username, email, password string, agreement bool, locale string) (Token, error)
Creates a new account with the given username, email and password.
This can only be used when the client authenticated itself using client credentials.
username: the accounts username. Used as displayName if no other is set and used when tagging people (@username@domain.tld). Usernames can't be changed, but a profile can be moved to a new username which will change the username but break all associated statuses, follows, ... email: the initial email address, which will receive the "Confirm Account" email password: the initial password agreement: agree or disagree to the locale rules, terms of use and privacy policy locale: language of the initial email (ISO6391, i.e. 'en')
Returns a new access token associated with the account, which replaces the previous token
func GetAccessTokenFromAuthorizationCode ¶
func GetAccessTokenFromAuthorizationCode(baseUrl, clientId, clientSecret, authorizationCode, scope, redirectUri string) (Token, error)
Exchanges an authorization code for an access token
authorizationCode: the authorization code received from the user scope: space-separated list of scopes to be authorized for redirectUri: uri the user will be redirected to, which will have the access token attached as url param (default: urn:ietf:wg:oauth:2.0:oob)
Returns a new token
func GetAccessTokenFromCredentials ¶
Gets a token by authorizing the application using its client credentials.
scope: space-separated list of scopes to be authorized for
Returns a new token ¶
Note: the token received from this method is an application token, not an account token. It can be used for functions which require an authentication, but will fail for all functions requiring a user (like posting a status, ...).
func GetAccessTokenFromLogin ¶
func GetAccessTokenFromLogin(baseUrl, clientId, clientSecret, username, password, scope, redirectUri string) (Token, error)
Gets a token using login credentials
username: username to log in with password: password to log in with scope: space-separated list of scopes to be authorized for redirectUri: uri the user will be redirected to, which will have the access token attached as url param (default: urn:ietf:wg:oauth:2.0:oob)
Returns a new token
Source Files ¶
- accounts.go
- apps.go
- blocks.go
- books.go
- constants.go
- custom_emojis.go
- domain_blocks.go
- endorsements.go
- entities.go
- favourites.go
- filters.go
- follow_requests.go
- follow_suggestions.go
- instance.go
- lists.go
- media_attachments.go
- mutes.go
- notifications.go
- oauth.go
- polls.go
- reports.go
- rest.go
- scheduled_statuses.go
- search.go
- statuses.go
- timelines.go