Documentation
¶
Index ¶
- type API
- func (api API) Delete(endpoint string, values url.Values, dest interface{}) error
- func (api API) Do(method string, endpoint string, values url.Values) (io.ReadCloser, error)
- func (api API) Get(endpoint string, values url.Values, dest interface{}) error
- func (api API) Post(endpoint string, values url.Values, dest interface{}) error
- type Account
- type Accounts
- func (accounts Accounts) Block(id string) (Account, error)
- func (accounts Accounts) Follow(id string) (Account, error)
- func (accounts Accounts) Followers(id string) ([]Account, error)
- func (accounts Accounts) Following(id string) ([]Account, error)
- func (accounts Accounts) Get(id string) (Account, error)
- func (accounts Accounts) Mute(id string) (Account, error)
- func (accounts Accounts) Relationships(ids ...int) ([]Relationship, error)
- func (accounts Accounts) Search(q string, limit int) ([]Account, error)
- func (accounts Accounts) Statuses(id string, params url.Values) ([]Status, error)
- func (accounts Accounts) Unblock(id string) (Account, error)
- func (accounts Accounts) Unfollow(id string) (Account, error)
- func (accounts Accounts) Unmute(id string) (Account, error)
- func (accounts Accounts) VerifyCredentials() (Account, error)
- type App
- type Application
- type Attachment
- type Blocks
- type Card
- type Context
- type Error
- type Favourites
- type FollowRequests
- type Follows
- type Instance
- type Instances
- type Mention
- type Mutes
- type Notification
- type Notifications
- type Relationship
- type Report
- type Reports
- type Results
- type Search
- type Status
- type Statuses
- func (statuses Statuses) Card(id string) (Card, error)
- func (statuses Statuses) Context(id string) (Context, error)
- func (statuses Statuses) Delete(id string) error
- func (statuses Statuses) Favourite(id string) (Status, error)
- func (statuses Statuses) Favourites(id string) ([]Account, error)
- func (statuses Statuses) Get(id string) (Status, error)
- func (statuses Statuses) Reblog(id string) (Status, error)
- func (statuses Statuses) Reblogs(id string) ([]Account, error)
- func (statuses Statuses) Unfavourite(id string) (Status, error)
- func (statuses Statuses) Unreblog(id string) (Status, error)
- func (statuses Statuses) Update(status string, v url.Values) (Status, error)
- type Tag
- type Timelines
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
API contains necessary informations to work with Mastodons API.
type Account ¶
type Account struct { ID string `json:"id"` // The ID of the account Username string `json:"username"` // The username of the account Acct string `json:"acct"` // Equals username for local users, includes @domain for remote ones DisplayName string `json:"display_name"` // The account's display name Note string `json:"note"` // Biography of user URL string `json:"url"` // URL of the user's profile page (can be remote) Avatar string `json:"avatar"` // URL to the avatar image Header string `json:"header"` // URL to the header image Locked bool `json:"locked"` // Boolean for when the account cannot be followed without waiting for approval first CreatedAt string `json:"created_at"` // The time the account was created Followers int `json:"followers_count"` // The number of followers for the account Following int `json:"following_count"` // The number of accounts the given account is following Statuses int `json:"statuses_count"` // The number of statuses the account has made }
Account holds informations about an account.
type Accounts ¶
type Accounts struct {
// contains filtered or unexported fields
}
Accounts implements methods under /accounts.
func (Accounts) Relationships ¶
func (accounts Accounts) Relationships(ids ...int) ([]Relationship, error)
Relationships returns an slice of Relationships of the current user to a list of given accounts.
func (Accounts) Search ¶
Search returns an slice of matching Accounts. Will lookup an account remotely if the search term is in the username@domain format and not yet in the database.
func (Accounts) Statuses ¶
Statuses returns an slice of statuses. Accepted params are: only_media: Only return statuses that have media attachments exclude_replies: Skip statuses that reply to other statuses
func (Accounts) VerifyCredentials ¶
VerifyCredentials returns the authenticated user's account.
type App ¶
type App struct { Token *oauth2.Token Config *oauth2.Config API *API Accounts *Accounts Blocks *Blocks Favourites *Favourites FollowRequests *FollowRequests Follows *Follows Instances *Instances Mutes *Mutes Notifications *Notifications Reports *Reports Search *Search Statuses *Statuses Timelines *Timelines }
App holds the AccessToken and the OAuth2 config.
func (App) AuthCodeURL ¶
AuthCodeURL builds a URL to obtain an AccessCode.
type Application ¶
type Application struct { ID string `json:"id"` Name string `json:"name"` // Name of the app Website string `json:"website"` // Homepage URL of the app ClientID string `json:"client_id"` ClientSecret string `json:"client_secret"` }
Application holds informations about an application.
type Attachment ¶
type Attachment struct { ID string `json:"id"` // ID of the attachment Type string `json:"type"` // One of: "image", "video", "gifv" URL string `json:"url"` // URL of the locally hosted version of the image RemoteURL string `json:"remote_url"` // For remote images, the remote URL of the original image PreviewURL string `json:"preview_url"` // URL of the preview image TextURL string `json:"text_url"` // Shorter URL for the image, for insertion into text (only present on local images) }
Attachment holds informations about an attachment.
type Blocks ¶
type Blocks struct {
// contains filtered or unexported fields
}
Blocks implements methods under /blocks.
type Card ¶
type Card struct { URL string `json:"url"` // The url associated with the card Title string `json:"title"` // The title of the card Description string `json:"description"` // The card description Image string `json:"image"` // The image associated with the card, if any }
Card holds informations about a card.
type Context ¶
type Context struct { Ancestors []Status `json:"ancestors"` // The ancestors of the status in the conversation, as a list of Statuses Descendants []Status `json:"descendants"` // The descendants of the status in the conversation, as a list of Statuses }
Context holds informations about a statuses context.
type Error ¶
type Error struct {
Error string `json:"error"` // A textual description of the error
}
Error holds informations about an error.
type Favourites ¶
type Favourites struct {
// contains filtered or unexported fields
}
Favourites implements methods under /favourites.
func (Favourites) Get ¶
func (favourites Favourites) Get() ([]Status, error)
Get returns an slice of statuses favourited by the authenticated user.
type FollowRequests ¶
type FollowRequests struct {
// contains filtered or unexported fields
}
FollowRequests implements methods under /follow_requests.
func (FollowRequests) Authorize ¶
func (followRequests FollowRequests) Authorize(id string) error
Authorize authorizes a follow request.
func (FollowRequests) Get ¶
func (followRequests FollowRequests) Get() ([]Account, error)
Get returns an slice of accounts which have requested to follow the authenticated user.
func (FollowRequests) Reject ¶
func (followRequests FollowRequests) Reject(id string) error
Reject rejects a follow request.
func (FollowRequests) RejectFalseIcons ¶
func (followRequests FollowRequests) RejectFalseIcons(id string) error
RejectFalseIcons rejects a follow request.
type Follows ¶
type Follows struct {
// contains filtered or unexported fields
}
Follows implements methods under /follows.
type Instance ¶
type Instance struct { URI string `json:"uri"` // URI of the current instance Title string `json:"title"` // The instance's title Description string `json:"description"` // A description for the instance Email string `json:"email"` // An email address which can be used to contact the instance administrator }
Instance holds informations about an instance.
type Instances ¶
type Instances struct {
// contains filtered or unexported fields
}
Instances implements methods under /instance.
type Mention ¶
type Mention struct { ID string `json:"id"` // Account ID URL string `json:"url"` // URL of user's profile (can be remote) Username string `json:"username"` // The username of the account Acct string `json:"acct"` // Equals username for local users, includes @domain for remote ones }
Mention holds informations about a mention.
type Mutes ¶
type Mutes struct {
// contains filtered or unexported fields
}
Mutes implements methods under /mutes.
type Notification ¶
type Notification struct { ID string `json:"id"` // The notification ID Type string `json:"type"` // One of: "mention", "reblog", "favourite", "follow" CreatedAt string `json:"created_at"` // The time the notification was created Account *Account `json:"account"` // The Account sending the notification to the user Status *Status `json:"status"` // The Status associated with the notification, if applicable }
Notification holds informations about a notification.
type Notifications ¶
type Notifications struct {
// contains filtered or unexported fields
}
Notifications implements methods under /notifications.
func (Notifications) Clear ¶
func (notifications Notifications) Clear() error
Clear deletes all notifications from the Mastodon server for the authenticated user.
func (Notifications) Get ¶
func (notifications Notifications) Get() ([]Notification, error)
Get returns a list of notifications for the authenticated user.
func (Notifications) GetSingle ¶
func (notifications Notifications) GetSingle(id string) (Notification, error)
GetSingle returns the notification.
type Relationship ¶
type Relationship struct { Following bool `json:"following"` // Whether the user is currently following the account FollowedBy bool `json:"followed_by"` // Whether the user is currently being followed by the account Blocking bool `json:"blocking"` // Whether the user is currently blocking the account Muting bool `json:"muting"` // Whether the user is currently muting the account Requested bool `json:"requested"` // Whether the user has requested to follow the account }
Relationship holds informations about a relationship.
type Report ¶
type Report struct { ID string `json:"id"` // The ID of the report ActionTaken string `json:"action_taken"` // The action taken in response to the report }
Report holds informations about a report.
type Reports ¶
type Reports struct {
// contains filtered or unexported fields
}
Reports implements methods under /reports.
type Results ¶
type Results struct { Accounts []Account `json:"accounts"` // An array of matched Accounts Statuses []Status `json:"statuses"` // An array of matchhed Statuses }
Results holds informations about results.
type Search ¶
type Search struct {
// contains filtered or unexported fields
}
Search implements methods under /search.
type Status ¶
type Status struct { ID string `json:"id"` // The ID of the status URI string `json:"uri"` // A Fediverse-unique resource ID URL string `json:"url"` // URL to the status page (can be remote) Account *Account `json:"account"` // The Account which posted the status InReplyToID string `json:"in_reply_to_id"` // null or the ID of the status it replies to InReplyToAccountID string `json:"in_reply_to_account_id"` // null or the ID of the account it replies to Reblog *Status `json:"reblog"` // null or the reblogged Status Content string `json:"content"` // Body of the status; this will contain HTML (remote HTML already sanitized) CreatedAt string `json:"created_at"` // The time the status was created Reblogs int `json:"reblogs_count"` // The number of reblogs for the status Favourites int `json:"favourites_count"` // The number of favourites for the status Reblogged bool `json:"reblogged"` // Whether the authenticated user has reblogged the status Favourited bool `json:"favourited"` // Whether the authenticated user has favourited the status Sensitive bool `json:"sensitive"` // Whether media attachments should be hidden by default SpoilerText string `json:"spoiler_text"` // If not empty, warning text that should be displayed before the actual content Visibility string `json:"visibility"` // One of: public, unlisted, private, direct MediaAttachments []Attachment `json:"media_attachments"` // An array of Attachments Mentions []Mention `json:"mentions"` // An array of Mentions Tags []Tag `json:"tags"` // An array of Tags Application *Application `json:"application"` // Application from which the status was posted }
Status holds informations about a status.
type Statuses ¶
type Statuses struct {
// contains filtered or unexported fields
}
Statuses implements methods under /statuses.
func (Statuses) Favourites ¶
Favourites returns an array of accounts.
func (Statuses) Unfavourite ¶
Unfavourite deletes a favourited status.
func (Statuses) Update ¶
Update posts and returns a new status. Accepted params are: in_reply_to_id: local ID of the status you want to reply to media_ids: array of media IDs to attach to the status (maximum 4) sensitive: set this to mark the media of the status as NSFW spoiler_text: text to be shown as a warning before the actual content visibility: either "direct", "private", "unlisted" or "public"
type Tag ¶
type Tag struct { Name string `json:"name"` // The hashtag, not including the preceding # URL string `json:"url"` // The URL of the hashtag }
Tag holds informations about a tag.
type Timelines ¶
type Timelines struct {
// contains filtered or unexported fields
}
Timelines implements methods under /timelines.