Documentation ¶
Index ¶
- func GetLocalPath() (string, error)
- func OpenUrl(url string) error
- type Gotodon
- func CreateClient(baseUrl, scope, redirectUri, filepath string) Gotodon
- func CreateDefaultClient(baseUrl, filepath string) Gotodon
- func LoadClient(path string) (error, Gotodon)
- func LoadClientFromAccessToken(baseUrl, accessToken string) (error, Gotodon)
- func LoadClientFromString(dat string) (error, Gotodon)
- func (client *Gotodon) AuthorizeWithAuthorizationCode(authorizationCode string) error
- func (client *Gotodon) AuthorizeWithClientCredentials() error
- func (client *Gotodon) AuthorizeWithLogin(username, password string) error
- func (client *Gotodon) AuthorizeWithLoginAgain() error
- func (client *Gotodon) AuthorizeWithLoginOnce(username, password string) error
- func (client *Gotodon) BlockDomain(domain string) error
- func (client *Gotodon) ClearNotifications() error
- func (client *Gotodon) CreateAccount(username, email, password string, agreement bool, locale string) error
- func (client *Gotodon) CreateFilter(phrase string, context []string, irreversible, wholeWord bool, expiresIn int) (MFilter, error)
- func (client *Gotodon) CreateList(title string) (MList, error)
- func (client *Gotodon) CreateSubscription(endpoint, p256dh, auth string, follow, favourite, reblog, mention, poll bool) (MPushSubscription, error)
- func (client *Gotodon) DeleteSubscription() error
- func (client *Gotodon) GetAccount(accountId string) (MAccount, error)
- func (client *Gotodon) GetAccountBlocks() MAccountBook
- func (client *Gotodon) GetAssociatedAccount() (MAccount, error)
- func (client *Gotodon) GetAuthorizeUrl() string
- func (client *Gotodon) GetConversations() MConversationBook
- func (client *Gotodon) GetCustomEmojis() ([]gotodonr.Emoji, error)
- func (client *Gotodon) GetDomainBlocksBook() gotodonr.StringBook
- func (client *Gotodon) GetEndorsements() MAccountBook
- func (client *Gotodon) GetFavourites() MStatusBook
- func (client *Gotodon) GetFilter(filterId string) (MFilter, error)
- func (client *Gotodon) GetFilters() ([]MFilter, error)
- func (client *Gotodon) GetFollowRequests() MAccountBook
- func (client *Gotodon) GetFollowSuggestions() ([]MAccount, error)
- func (client *Gotodon) GetHashtagTimeline(hashTag string, local, onlyMedia bool) MStatusBook
- func (client *Gotodon) GetHomeTimeline() MStatusBook
- func (client *Gotodon) GetInstance() (gotodonr.Instance, error)
- func (client *Gotodon) GetList(listId string) (MList, error)
- func (client *Gotodon) GetListTimeline(listId string) MStatusBook
- func (client *Gotodon) GetLists() ([]MList, error)
- func (client *Gotodon) GetMutes() MAccountBook
- func (client *Gotodon) GetNotification(notificationId string) (MNotification, error)
- func (client *Gotodon) GetNotificationsBook(excludeTypes []string, accountId string) MNotificationBook
- func (client *Gotodon) GetPoll(pollId string) (MPoll, error)
- func (client *Gotodon) GetPublicTimeline(local, onlyMedia bool) MStatusBook
- func (client *Gotodon) GetRelationships(accountIds ...string) ([]MRelationship, error)
- func (client *Gotodon) GetScheduledStatus(scheduledId string) (MScheduledStatus, error)
- func (client *Gotodon) GetScheduledStatuses() ([]MScheduledStatus, error)
- func (client *Gotodon) GetStatus(statusId string) (MStatus, error)
- func (client *Gotodon) GetSubscription() (MPushSubscription, error)
- func (client *Gotodon) HasAccountAccess() (bool, error)
- func (client *Gotodon) HasClientAccess() bool
- func (client *Gotodon) IsAuthorized() bool
- func (client *Gotodon) IsRegistered() bool
- func (client *Gotodon) PostMediaStatus(status, inReplyToId string, mediaIds []string, sensitive bool, ...) (MStatus, error)
- func (client *Gotodon) PostPollStatus(baseUrl, accessToken, status, inReplyToId string, pollOptions []string, ...) (MStatus, error)
- func (client *Gotodon) PostStatus(status, inReplyToId string, mediaIds []string, pollOptions []string, ...) (MStatus, error)
- func (client *Gotodon) PostTextStatus(status, inReplyToId string, sensitive bool, ...) (MStatus, error)
- func (client *Gotodon) Register(clientname, website string) error
- func (client *Gotodon) RevokeAccessToken() error
- func (client *Gotodon) ScheduleMediaStatus(status, scheduledAt, inReplyToId string, mediaIds []string, sensitive bool, ...) (MScheduledStatus, error)
- func (client *Gotodon) SchedulePollStatus(status, scheduledAt, inReplyToId string, pollOptions []string, ...) (MScheduledStatus, error)
- func (client *Gotodon) ScheduleStatus(status, scheduledAt, inReplyToId string, mediaIds []string, ...) (MScheduledStatus, error)
- func (client *Gotodon) ScheduleTextStatus(status, scheduledAt, inReplyToId string, sensitive bool, ...) (MScheduledStatus, error)
- func (client *Gotodon) Search(query string, resolve, following bool, limit, offset int) (gotodonr.Result, error)
- func (client *Gotodon) SearchAccounts(query string, limit int, resolve, following bool) ([]MAccount, error)
- func (client *Gotodon) Store(path string) error
- func (client *Gotodon) ToString() (error, string)
- func (client *Gotodon) TokenMaintenance() error
- func (client *Gotodon) UnblockDomain(domain string) error
- func (client *Gotodon) UpdateProfile(displayName, biography, locked, privacy, sensitive, language string, ...) (MAccount, error)
- func (client *Gotodon) UpdateProfileAvatar(path string) (MAccount, error)
- func (client *Gotodon) UpdateProfileHeader(path string) (MAccount, error)
- func (client *Gotodon) UpdateSubscription(follow, favourite, reblog, mention, poll bool) (MPushSubscription, error)
- func (client *Gotodon) UploadAndPostMediaStatus(status, inReplyToId string, medias []gotodonr.Media, sensitive bool, ...) (MStatus, error)
- func (client *Gotodon) UploadAndScheduleMediaStatus(status, scheduledAt, inReplyToId string, medias []gotodonr.Media, ...) (MScheduledStatus, error)
- func (client *Gotodon) UploadMedia(filePath, description string, focusX, focusY float64) (MAttachment, error)
- func (client *Gotodon) VerifyAccessToken() error
- func (client *Gotodon) VerifyAccountCredentials() (MAccount, error)
- type Login
- type MAccount
- func (account *MAccount) AuthorizeFollowRequest(client *Gotodon) error
- func (account *MAccount) BlockAccount(client *Gotodon) (MRelationship, error)
- func (account *MAccount) DeleteFollowSuggestion(client *Gotodon) error
- func (account *MAccount) Endorse(client *Gotodon) (gotodonr.Relationship, error)
- func (account *MAccount) Follow(client *Gotodon, hideReblogs string) (MRelationship, error)
- func (account *MAccount) GetFolloweds(client *Gotodon) MAccountBook
- func (account *MAccount) GetFollowers(client *Gotodon) MAccountBook
- func (account *MAccount) GetLists(client *Gotodon) ([]MList, error)
- func (account *MAccount) GetStatuses(client *Gotodon, onlyMedia, onlyPinned, excludeReplies, excludeReblogs bool) MStatusBook
- func (account *MAccount) Mute(client *Gotodon, notifications bool) (gotodonr.Relationship, error)
- func (account *MAccount) RejectFollowRequest(client *Gotodon) error
- func (account *MAccount) Report(client *Gotodon, statusIds []string, comment string, forward bool) error
- func (account *MAccount) UnblockAccount(client *Gotodon) (MRelationship, error)
- func (account *MAccount) Unendorse(client *Gotodon) (gotodonr.Relationship, error)
- func (account *MAccount) Unfollow(client *Gotodon) (MRelationship, error)
- func (account *MAccount) Unmute(client *Gotodon) (gotodonr.Relationship, error)
- type MAccountBook
- type MAlerts
- type MApp
- type MApplication
- type MAttachment
- type MCard
- type MContext
- type MConversation
- type MConversationBook
- type MEmoji
- type MError
- type MField
- type MFilter
- type MFocus
- type MHistory
- type MInstance
- type MList
- func (list *MList) AddAccounts(client *Gotodon, accounts ...string) error
- func (list *MList) DeleteList(client *Gotodon) error
- func (list *MList) GetAccounts(client *Gotodon) MAccountBook
- func (list *MList) RemoveAccounts(client *Gotodon, accounts ...string) error
- func (list *MList) Update(client *Gotodon, title string) (MList, error)
- type MMedia
- type MMention
- type MMeta
- type MMetaAttributes
- type MNotification
- type MNotificationBook
- type MPoll
- type MPollOption
- type MPushSubscription
- type MRelationship
- type MResult
- type MScheduledStatus
- type MSource
- type MStats
- type MStatus
- func (status *MStatus) Delete(client *Gotodon) error
- func (status *MStatus) Favourite(client *Gotodon) (MStatus, error)
- func (status *MStatus) GetCard(client *Gotodon) (gotodonr.Card, error)
- func (status *MStatus) GetContext(client *Gotodon) (gotodonr.Context, error)
- func (status *MStatus) GetFavouritedBy(client *Gotodon) MAccountBook
- func (status *MStatus) GetRebloggedBy(client *Gotodon) MAccountBook
- func (status *MStatus) Mute(client *Gotodon) (MStatus, error)
- func (status *MStatus) Pin(client *Gotodon) (MStatus, error)
- func (status *MStatus) Reblog(client *Gotodon) (MStatus, error)
- func (status *MStatus) Unfavourite(client *Gotodon) (MStatus, error)
- func (status *MStatus) Unmute(client *Gotodon) (MStatus, error)
- func (status *MStatus) Unpin(client *Gotodon) (MStatus, error)
- func (status *MStatus) Unreblog(client *Gotodon) (MStatus, error)
- type MStatusBook
- type MStatusParams
- type MTag
- type MToken
- type MURLs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLocalPath ¶
Returns the path to the directory the go app is executed from
func OpenUrl ¶
OpenUrl opens the given url in the users default browser.
Kudos to icza (https://stackoverflow.com/a/39324149)
Types ¶
type Gotodon ¶
type Gotodon struct { BaseUrl string `json:"base_url"` Scope string `json:"scope"` RedirectUri string `json:"redirect_uri"` Filepath string `json:"-"` MApp MToken Login }
A Mastodon client API written in Go
func CreateClient ¶
Creates a new client
func CreateDefaultClient ¶
Creates a new client with default settings
func LoadClientFromAccessToken ¶
Loads a client from the given baseUrl and accessToken
However, the client lacks various variables (like ClientId, ClientSecret, ...) which prevents all token-related functions (like RevokeToken and all Authorization methods)
func LoadClientFromString ¶
Loads a client from the given string
func (*Gotodon) AuthorizeWithAuthorizationCode ¶
Exchanges the AuthorizationCode to retrieve an AccessToken for this client
authorizationCode: the authorization code received from the user
Updates the client with a new token
func (*Gotodon) AuthorizeWithClientCredentials ¶
Gets a token by authorizing the application using its client credentials.
scope: space-separated list of scopes to be authorized for
Updates the client with 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, ...). After authorizing this way, use CreateAccount(...) which creates an account which can be used for all those functions (but will fail if the server has account registration turned off).
func (*Gotodon) AuthorizeWithLogin ¶
Retrieves an AccessToken for this client by logging in with the login credentials. Stores the username and password, which allows the usage of AuthorizeWithLoginAgain() (storing the username and password is unsafe and it is encouraged to use the authorization code flow instead).
username: username to log in with password: password to log in with
Updates the client with a new token
func (*Gotodon) AuthorizeWithLoginAgain ¶
Retrieves an AccessToken for this client by using AuthorizeWithLogin(email, password) using the stored username and password (storing the username and password is unsafe and it is encouraged to use the authorization code flow instead).
func (*Gotodon) AuthorizeWithLoginOnce ¶
Retrieves an AccessToken for this client by logging in with the login credentials. Does not store the username and password, which prevents the usage of AuthorizeWithLoginAgain() (this won't store the username and password which makes it safer than AuthorizeWithLogin, but it is encouraged to use the authorization code flow instead).
username: username to log in with password: password to log in with
Updates the client with a new token
func (*Gotodon) BlockDomain ¶
Blocks the given domain (strip any protocols and such, domain needs to be 'domain.tld')
domain: the domain to be blocked
func (*Gotodon) ClearNotifications ¶
Clear all notifications
func (*Gotodon) CreateAccount ¶
func (client *Gotodon) CreateAccount(username, email, password string, agreement bool, locale string) 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 (*Gotodon) CreateFilter ¶
func (client *Gotodon) CreateFilter(phrase string, context []string, irreversible, wholeWord bool, expiresIn int) (MFilter, 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 (*Gotodon) CreateList ¶
Creates a new list
title: title of the new list
Returns the newly created list
func (*Gotodon) CreateSubscription ¶
func (client *Gotodon) CreateSubscription(endpoint, p256dh, auth string, follow, favourite, reblog, mention, poll bool) (MPushSubscription, 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 (*Gotodon) DeleteSubscription ¶
Deletes the current subscription
func (*Gotodon) GetAccountBlocks ¶
func (client *Gotodon) GetAccountBlocks() MAccountBook
Gets a book of accounts the user has blocked.
Returns an AccountBook which can be used to scroll through the pages of blocked accounts.
func (*Gotodon) GetAssociatedAccount ¶
Gets the Account associated with the client.
Returns the account
func (*Gotodon) GetAuthorizeUrl ¶
Returns an url at which a user can grant access to his account which will then return an AuthorizationCode.
The AuthorizationCode can be used by AuthorizeWithAuthorizationCode to get an AccessToken.
func (*Gotodon) GetConversations ¶
func (client *Gotodon) GetConversations() MConversationBook
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 (*Gotodon) GetDomainBlocksBook ¶
func (client *Gotodon) GetDomainBlocksBook() gotodonr.StringBook
Gets a book which can be used to scroll through pages of domains the user has blocked
Returns a StringBook which can be used to scroll through the pages or collect all pages at once
func (*Gotodon) GetEndorsements ¶
func (client *Gotodon) GetEndorsements() MAccountBook
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)
Returns an AccountBook which can be used to scroll through the pages or collect all pages at once
func (*Gotodon) GetFavourites ¶
func (client *Gotodon) GetFavourites() MStatusBook
Gets a book which can be used to scroll through pages of statuses favourited by the user
Returns a StatusBook which can be used to scroll through the pages or collect all pages at once
func (*Gotodon) GetFilter ¶
Get a specific filter
filterId: identifier of the filter to be retrieved
Returns the filter for the given id
func (*Gotodon) GetFollowRequests ¶
func (client *Gotodon) GetFollowRequests() MAccountBook
Gets a book which can be used to scroll through pages of open follower requests
Returns an AccountBook which can be used to scroll through the pages or collect all pages at once
func (*Gotodon) GetFollowSuggestions ¶
Gets all follow suggestions
Returns a slice of suggested accounts
func (*Gotodon) GetHashtagTimeline ¶
func (client *Gotodon) GetHashtagTimeline(hashTag string, local, onlyMedia bool) MStatusBook
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)
Returns a StatusBook used to scroll through the pages or collect them all at once
func (*Gotodon) GetHomeTimeline ¶
func (client *Gotodon) GetHomeTimeline() MStatusBook
Gets a book used to scroll through the pages of statuses in the home timeline
Returns a StatusBook used to scroll through the pages or collect them all at once
func (*Gotodon) GetListTimeline ¶
func (client *Gotodon) GetListTimeline(listId string) MStatusBook
Gets a book used to scroll through the pages of statuses in a lists timeline
listId: identifier of the list whose timeline to retrieve
Returns a StatusBook used to scroll through the pages or collect them all at once
func (*Gotodon) GetMutes ¶
func (client *Gotodon) GetMutes() MAccountBook
Gets a book used to scroll through pages of muted accounts
Returns an AccountBook used to scroll through the pages or collect them all at once
func (*Gotodon) GetNotification ¶
func (client *Gotodon) GetNotification(notificationId string) (MNotification, error)
Get a notification
notificationId: identifier of the notification to get
Returns the notifications
func (*Gotodon) GetNotificationsBook ¶
func (client *Gotodon) GetNotificationsBook(excludeTypes []string, accountId string) MNotificationBook
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)
Returns a NotificationBook used to scroll through the pages or collect all at once
func (*Gotodon) GetPublicTimeline ¶
func (client *Gotodon) GetPublicTimeline(local, onlyMedia bool) MStatusBook
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 (*Gotodon) GetRelationships ¶
func (client *Gotodon) GetRelationships(accountIds ...string) ([]MRelationship, 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 (*Gotodon) GetScheduledStatus ¶
func (client *Gotodon) GetScheduledStatus(scheduledId string) (MScheduledStatus, error)
Gets a scheduled status
Returns the scheduled status
func (*Gotodon) GetScheduledStatuses ¶
func (client *Gotodon) GetScheduledStatuses() ([]MScheduledStatus, error)
Get all scheduled statuses
Returns a slice of scheduled statuses
func (*Gotodon) GetStatus ¶
Gets a status
statusId: identifier of the status to get
Returns the status
func (*Gotodon) GetSubscription ¶
func (client *Gotodon) GetSubscription() (MPushSubscription, error)
Gets the current subscription
func (*Gotodon) HasAccountAccess ¶
Checks if the client can access account-level functions (functions bound to an account). Account-Level functions also include client-level functions (so if hasAccountAccess is true, it is safe to assume that hasClientAccess is also true).
func (*Gotodon) HasClientAccess ¶
Checks if the client can access client-level functions (functions which are not bound to an account)
func (*Gotodon) IsAuthorized ¶
Checks if the client is authorized (i.e. retrieved an AccessToken)
func (*Gotodon) IsRegistered ¶
Checks if the client is registered (i.e. retrieved a ClientId and ClientSecret)
func (*Gotodon) PostMediaStatus ¶
func (client *Gotodon) PostMediaStatus(status, inReplyToId string, mediaIds []string, sensitive bool, spoilerText, visibility, language, idempotencyKey string) (MStatus, 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 (*Gotodon) PostPollStatus ¶
func (client *Gotodon) PostPollStatus(baseUrl, accessToken, status, inReplyToId string, pollOptions []string, pollExpiresIn int, pollMultiple, pollHideTotals, sensitive bool, spoilerText, visibility, language, idempotencyKey string) (MStatus, 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 (*Gotodon) PostStatus ¶
func (client *Gotodon) PostStatus(status, inReplyToId string, mediaIds []string, pollOptions []string, pollExpiresIn int, pollMultiple, pollHideTotals, sensitive bool, spoilerText, visibility, language, idempotencyKey string) (MStatus, 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 (*Gotodon) PostTextStatus ¶
func (client *Gotodon) PostTextStatus(status, inReplyToId string, sensitive bool, spoilerText, visibility, language, idempotencyKey string) (MStatus, 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 (*Gotodon) Register ¶
Registers the client as an app
clientName: the name of the application (is shown on statuses) website: a website providing more information about your application (optional)
Returns an error (if one occurs)
func (*Gotodon) RevokeAccessToken ¶
Revoke this clients AccessToken (all authorized calls will fail until the client is authorized again)
func (*Gotodon) ScheduleMediaStatus ¶
func (client *Gotodon) ScheduleMediaStatus(status, scheduledAt, inReplyToId string, mediaIds []string, sensitive bool, spoilerText, visibility, language, idempotencyKey string) (MScheduledStatus, 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 (*Gotodon) SchedulePollStatus ¶
func (client *Gotodon) SchedulePollStatus(status, scheduledAt, inReplyToId string, pollOptions []string, pollExpiresIn int, pollMultiple, pollHideTotals, sensitive bool, spoilerText, visibility, language, idempotencyKey string) (MScheduledStatus, 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 (*Gotodon) ScheduleStatus ¶
func (client *Gotodon) ScheduleStatus(status, scheduledAt, inReplyToId string, mediaIds []string, pollOptions []string, pollExpiresIn int, pollMultiple, pollHideTotals, sensitive bool, spoilerText, visibility, language, idempotencyKey string) (MScheduledStatus, 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 (*Gotodon) ScheduleTextStatus ¶
func (client *Gotodon) ScheduleTextStatus(status, scheduledAt, inReplyToId string, sensitive bool, spoilerText, visibility, language, idempotencyKey string) (MScheduledStatus, 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 (*Gotodon) Search ¶
func (client *Gotodon) Search(query string, resolve, following bool, limit, offset int) (gotodonr.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
func (*Gotodon) SearchAccounts ¶
func (client *Gotodon) SearchAccounts(query string, limit int, resolve, following bool) ([]MAccount, 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 (*Gotodon) Store ¶
Stores the client at the given path (leave empty to store at client.Filepath)
func (*Gotodon) TokenMaintenance ¶
Check if the AccessToken is invalid, and if so, get a new one (only possible when using Login as authorization method)
func (*Gotodon) UnblockDomain ¶
Unblocks the given domain (strip any protocols and such, domain needs to be 'domain.tld')
domain: the domain to be unblocked
func (*Gotodon) UpdateProfile ¶
func (client *Gotodon) UpdateProfile(displayName, biography, locked, privacy, sensitive, language string, fields map[string]string) (MAccount, 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 (*Gotodon) 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 (*Gotodon) 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 (*Gotodon) UpdateSubscription ¶
func (client *Gotodon) UpdateSubscription(follow, favourite, reblog, mention, poll bool) (MPushSubscription, 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
func (*Gotodon) UploadAndPostMediaStatus ¶
func (client *Gotodon) UploadAndPostMediaStatus(status, inReplyToId string, medias []gotodonr.Media, sensitive bool, spoilerText, visibility, language, idempotencyKey string) (MStatus, 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
func (*Gotodon) UploadAndScheduleMediaStatus ¶
func (client *Gotodon) UploadAndScheduleMediaStatus(status, scheduledAt, inReplyToId string, medias []gotodonr.Media, sensitive bool, spoilerText, visibility, language, idempotencyKey string) (MScheduledStatus, 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
func (*Gotodon) UploadMedia ¶
func (client *Gotodon) UploadMedia(filePath, description string, focusX, focusY float64) (MAttachment, 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
func (*Gotodon) VerifyAccessToken ¶
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
func (*Gotodon) 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 MAccount ¶
An account of a user, with profile data and statistics
func (*MAccount) AuthorizeFollowRequest ¶
Accepts a follower request
accountId: identifier of the account whose follow request should be accepted
func (*MAccount) BlockAccount ¶
func (account *MAccount) BlockAccount(client *Gotodon) (MRelationship, error)
Blocks the account.
Returns the updated relationship
func (*MAccount) DeleteFollowSuggestion ¶
Deletes a follow suggestion
func (*MAccount) Endorse ¶
func (account *MAccount) Endorse(client *Gotodon) (gotodonr.Relationship, error)
Endorses (pins) the account
Returns the updated relationship
func (*MAccount) Follow ¶
func (account *MAccount) Follow(client *Gotodon, hideReblogs string) (MRelationship, error)
Follow the account.
hideReblogs: show/hide reblogs in timelines and such (default: false)
Returns the new relationship
func (*MAccount) GetFolloweds ¶
func (account *MAccount) GetFolloweds(client *Gotodon) MAccountBook
Gets a book which can be used to scroll through pages of accounts followed by the 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 account 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 (*MAccount) GetFollowers ¶
func (account *MAccount) GetFollowers(client *Gotodon) MAccountBook
Gets a book which can be used to scroll through pages of followers
Returns an AccountBook which can be used to scroll through the pages or collect all pages at once ¶
Note that when account 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 (*MAccount) GetLists ¶
Get all lists containing an account
Returns a slice of lists containing the account
func (*MAccount) GetStatuses ¶
func (account *MAccount) GetStatuses(client *Gotodon, onlyMedia, onlyPinned, excludeReplies, excludeReblogs bool) MStatusBook
Gets a book which can be used to scroll through pages of statuses (visible to the user) posted by the 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 (*MAccount) Mute ¶
Mutes the account
notifications: if notifications for this account should be muted as well (default: true)
Returns the updated relationship
func (*MAccount) RejectFollowRequest ¶
Rejects a follower request
accountId: identifier of the account whose follow request should be rejected
func (*MAccount) Report ¶
func (account *MAccount) Report(client *Gotodon, statusIds []string, comment string, forward bool) error
Reports a user
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 (*MAccount) UnblockAccount ¶
func (account *MAccount) UnblockAccount(client *Gotodon) (MRelationship, error)
Unblocks the account
Returns the updated relationship
func (*MAccount) Unendorse ¶
func (account *MAccount) Unendorse(client *Gotodon) (gotodonr.Relationship, error)
Unendorses (unpins) the account
Returns the updated relationship
type MAccountBook ¶
type MAccountBook struct {
// contains filtered or unexported fields
}
Book used to scroll through accounts
func NewManagedAccountBook ¶
func NewManagedAccountBook(accountBook gotodonr.AccountBook) MAccountBook
Creates a new ManagedAccountBook
func (*MAccountBook) All ¶
func (book *MAccountBook) All() []MAccount
Returns all available accounts. Warning: Can take a long time (receives a maximum of 80 accounts per second)
func (*MAccountBook) Current ¶
func (book *MAccountBook) Current() []MAccount
Returns the values from the current page
func (*MAccountBook) Next ¶
func (book *MAccountBook) Next() []MAccount
Updates the book to the values from the next page
func (*MAccountBook) Previous ¶
func (book *MAccountBook) Previous() []MAccount
Updates the book to the values from the previous page
type MAlerts ¶
Set of alerts which a subscription can be subscribed to TODO: Should be booleans, but server returns JSON strings
type MApplication ¶
type MApplication struct {
gotodonr.Application
}
Display data of the application used to post a status
type MAttachment ¶
type MAttachment struct {
gotodonr.Attachment
}
Data of an attachment which can be added to a status
func (*MAttachment) UpdateMedia ¶
func (attachment *MAttachment) UpdateMedia(client *Gotodon, description string, focusX, focusY float64) (MAttachment, 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
type MConversationBook ¶
type MConversationBook struct {
// contains filtered or unexported fields
}
Book used to scroll through accounts
func NewManagedConversationBook ¶
func NewManagedConversationBook(conversationBook gotodonr.ConversationBook) MConversationBook
Creates a new ManagedConversationBook
func (*MConversationBook) All ¶
func (book *MConversationBook) All() []MConversation
Returns all available accounts. Warning: Can take a long time (receives a maximum of 80 accounts per second)
func (*MConversationBook) Current ¶
func (book *MConversationBook) Current() []MConversation
Returns the values from the current page
func (*MConversationBook) Next ¶
func (book *MConversationBook) Next() []MConversation
Updates the book to the values from the next page
func (*MConversationBook) Previous ¶
func (book *MConversationBook) Previous() []MConversation
Updates the book to the values from the previous page
type MFilter ¶
Data for a filter used to automatically hide statuses from users
func (*MFilter) DeleteFilter ¶
Removes a filter
func (*MFilter) UpdateFilter ¶
func (filter *MFilter) UpdateFilter(client *Gotodon, filterId, phrase string, context []string, irreversible, wholeWord bool, expiresIn int) (MFilter, 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 MList ¶
Lists allow the creation of timelines which only contains statuses by a specified set of accounts
func (*MList) AddAccounts ¶
Adds the accounts to the list
accounts: slice of accounts which should be added to the list
func (*MList) GetAccounts ¶
func (list *MList) GetAccounts(client *Gotodon) MAccountBook
Gets a book used to scroll through the pages of accounts in a list
Returns an AccountBook used to scroll through the pages or collect all at once
func (*MList) RemoveAccounts ¶
Removes the accounts from the list
accounts: slice of accounts which should be removed from the list
type MMetaAttributes ¶
type MMetaAttributes struct {
gotodonr.MetaAttributes
}
Metadata of an attachment
type MNotification ¶
type MNotification struct {
gotodonr.Notification
}
Data of a notification
func (*MNotification) Dismiss ¶
func (notification *MNotification) Dismiss(client *Gotodon) error
Dismisses the notification
Returns the notifications
type MNotificationBook ¶
type MNotificationBook struct {
// contains filtered or unexported fields
}
Book used to scroll through accounts
func NewManagedNotificationBook ¶
func NewManagedNotificationBook(notificationBook gotodonr.NotificationBook) MNotificationBook
Creates a new ManagedNotificationBook
func (*MNotificationBook) All ¶
func (book *MNotificationBook) All() []MNotification
Returns all available accounts. Warning: Can take a long time (receives a maximum of 80 accounts per second)
func (*MNotificationBook) Current ¶
func (book *MNotificationBook) Current() []MNotification
Returns the values from the current page
func (*MNotificationBook) Next ¶
func (book *MNotificationBook) Next() []MNotification
Updates the book to the values from the next page
func (*MNotificationBook) Previous ¶
func (book *MNotificationBook) Previous() []MNotification
Updates the book to the values from the previous page
type MPollOption ¶
type MPollOption struct {
gotodonr.PollOption
}
Data for a single choice in a poll
type MPushSubscription ¶
type MPushSubscription struct {
gotodonr.PushSubscription
}
Data for the push subscription
type MRelationship ¶
type MRelationship struct {
gotodonr.Relationship
}
Relationship data between two accounts
type MScheduledStatus ¶
type MScheduledStatus struct {
gotodonr.ScheduledStatus
}
Data of a scheduled status
func (*MScheduledStatus) Delete ¶
func (status *MScheduledStatus) Delete(client *Gotodon) error
Deletes a scheduled status
func (*MScheduledStatus) Update ¶
func (status *MScheduledStatus) Update(client *Gotodon, scheduledAt string) (MScheduledStatus, error)
Moves a scheduled status to a new time
scheduledAt: timestamp of when the status should be scheduled
Returns the updated scheduled status
type MStatus ¶
Data of a status
func (*MStatus) GetFavouritedBy ¶
func (status *MStatus) GetFavouritedBy(client *Gotodon) MAccountBook
Gets a book used to scroll through the pages of accounts which favourited the status
Returns an AccountBook which can be used to scroll through the pages or collect all at once
func (*MStatus) GetRebloggedBy ¶
func (status *MStatus) GetRebloggedBy(client *Gotodon) MAccountBook
Gets a book used to scroll through the pages of accounts which reblogged the status
Returns an AccountBook which can be used to scroll through the pages or collect all at once
func (*MStatus) Unfavourite ¶
Unfavourites the status
statusId: identifier of the status which should be unfavourited
Returns the status
type MStatusBook ¶
type MStatusBook struct {
// contains filtered or unexported fields
}
Book used to scroll through accounts
func NewManagedStatusBook ¶
func NewManagedStatusBook(statusBook gotodonr.StatusBook) MStatusBook
Creates a new ManagedStatusBook
func (*MStatusBook) All ¶
func (book *MStatusBook) All() []MStatus
Returns all available accounts. Warning: Can take a long time (receives a maximum of 80 accounts per second)
func (*MStatusBook) Current ¶
func (book *MStatusBook) Current() []MStatus
Returns the values from the current page
func (*MStatusBook) Next ¶
func (book *MStatusBook) Next() []MStatus
Updates the book to the values from the next page
func (*MStatusBook) Previous ¶
func (book *MStatusBook) Previous() []MStatus
Updates the book to the values from the previous page
type MStatusParams ¶
type MStatusParams struct {
gotodonr.StatusParams
}
Data of a status that is yet to be posted
Source Files ¶
- accounts.go
- apps.go
- blocks.go
- books.go
- client.go
- compat.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
- polls.go
- reports.go
- scheduled_statuses.go
- search.go
- statuses.go
- timelines.go