Documentation
¶
Overview ¶
Package mastodon is the library behind the mastodon command line: the HTTP client, request shaping, and the typed data models for mastodon.social.
All endpoints used here are public and require no authentication.
Index ¶
- Constants
- type Account
- type Client
- func (c *Client) Account(ctx context.Context, username string) (*Account, error)
- func (c *Client) Get(ctx context.Context, url string) ([]byte, error)
- func (c *Client) Instance(ctx context.Context) (*Instance, error)
- func (c *Client) Links(ctx context.Context, limit int) ([]*Link, error)
- func (c *Client) Posts(ctx context.Context, limit int) ([]*Status, error)
- func (c *Client) Timeline(ctx context.Context, hashtag string, limit int) ([]*Status, error)
- func (c *Client) Trends(ctx context.Context, limit int) ([]*Tag, error)
- type Domain
- type Instance
- type Link
- type Status
- type Tag
Constants ¶
View Source
const BaseURL = "https://" + Host + "/api/v1"
BaseURL is the root every v1 request is built from.
View Source
const Host = "mastodon.social"
Host is the Mastodon instance this client talks to.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
ID string `json:"id"`
Username string `json:"username"`
DisplayName string `json:"display_name"`
Note string `json:"note"`
URL string `json:"url"`
Followers int `json:"followers"`
Following int `json:"following"`
Statuses int `json:"statuses"`
CreatedAt string `json:"created_at"`
Bot bool `json:"bot"`
}
Account is a Mastodon user profile.
type Client ¶
type Client struct {
HTTP *http.Client
UserAgent string
Rate time.Duration
Retries int
// contains filtered or unexported fields
}
Client talks to mastodon.social over HTTP.
type Domain ¶
type Domain struct{}
Domain is the mastodon driver for the kit framework.
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme and identity for this domain.
type Instance ¶
type Instance struct {
URI string `json:"uri"`
Title string `json:"title"`
Description string `json:"description"`
Users int `json:"users"`
Statuses int `json:"statuses"`
Domains int `json:"domains"`
Version string `json:"version"`
}
Instance holds Mastodon instance statistics.
type Link ¶
type Link struct {
URL string `json:"url"`
Title string `json:"title"`
Description string `json:"description"`
Provider string `json:"provider"`
Accounts int `json:"accounts"`
Uses int `json:"uses"`
}
Link is a trending article/link shared on Mastodon.
type Status ¶
type Status struct {
ID string `json:"id"`
CreatedAt string `json:"created_at"`
URL string `json:"url"`
Content string `json:"content"`
Author string `json:"author"`
DisplayName string `json:"display_name"`
Reblogs int `json:"reblogs"`
Favourites int `json:"favourites"`
Replies int `json:"replies"`
Language string `json:"language"`
Sensitive bool `json:"sensitive"`
}
Status is a Mastodon post/toot.
Click to show internal directories.
Click to hide internal directories.