From 309dce6ff3f1b04b74c282c01de7256bb140bdde Mon Sep 17 00:00:00 2001 From: Darren O'Connor Date: Sun, 13 Nov 2022 21:14:40 +0000 Subject: [PATCH] minor spelling fixes --- accounts.go | 40 ++++++++++++++++++++-------------------- apps.go | 2 +- instance.go | 12 ++++++------ mastodon.go | 6 +++--- notification.go | 8 ++++---- polls.go | 6 +++--- report.go | 4 ++-- status.go | 26 +++++++++++++------------- streaming.go | 20 ++++++++++---------- 9 files changed, 62 insertions(+), 62 deletions(-) diff --git a/accounts.go b/accounts.go index a5e6823..0b43e4c 100644 --- a/accounts.go +++ b/accounts.go @@ -9,7 +9,7 @@ import ( "time" ) -// Account hold information for mastodon account. +// Account holds information for a mastodon account. type Account struct { ID ID `json:"id"` Username string `json:"username"` @@ -60,7 +60,7 @@ func (c *Client) GetAccount(ctx context.Context, id ID) (*Account, error) { return &account, nil } -// GetAccountCurrentUser return Account of current user. +// GetAccountCurrentUser returns the Account of current user. func (c *Client) GetAccountCurrentUser(ctx context.Context) (*Account, error) { var account Account err := c.doAPI(ctx, http.MethodGet, "/api/v1/accounts/verify_credentials", nil, &account, nil) @@ -129,7 +129,7 @@ func (c *Client) AccountUpdate(ctx context.Context, profile *Profile) (*Account, return &account, nil } -// GetAccountStatuses return statuses by specified accuont. +// GetAccountStatuses return statuses by specified account. func (c *Client) GetAccountStatuses(ctx context.Context, id ID, pg *Pagination) ([]*Status, error) { var statuses []*Status err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/accounts/%s/statuses", url.PathEscape(string(id))), nil, &statuses, pg) @@ -139,7 +139,7 @@ func (c *Client) GetAccountStatuses(ctx context.Context, id ID, pg *Pagination) return statuses, nil } -// GetAccountPinnedStatuses return statuses pinned by specified accuont. +// GetAccountPinnedStatuses returns statuses pinned by specified accuont. func (c *Client) GetAccountPinnedStatuses(ctx context.Context, id ID) ([]*Status, error) { var statuses []*Status params := url.Values{} @@ -151,7 +151,7 @@ func (c *Client) GetAccountPinnedStatuses(ctx context.Context, id ID) ([]*Status return statuses, nil } -// GetAccountFollowers return followers list. +// GetAccountFollowers returns followers list. func (c *Client) GetAccountFollowers(ctx context.Context, id ID, pg *Pagination) ([]*Account, error) { var accounts []*Account err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/accounts/%s/followers", url.PathEscape(string(id))), nil, &accounts, pg) @@ -161,7 +161,7 @@ func (c *Client) GetAccountFollowers(ctx context.Context, id ID, pg *Pagination) return accounts, nil } -// GetAccountFollowing return following list. +// GetAccountFollowing returns following list. func (c *Client) GetAccountFollowing(ctx context.Context, id ID, pg *Pagination) ([]*Account, error) { var accounts []*Account err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/accounts/%s/following", url.PathEscape(string(id))), nil, &accounts, pg) @@ -171,7 +171,7 @@ func (c *Client) GetAccountFollowing(ctx context.Context, id ID, pg *Pagination) return accounts, nil } -// GetBlocks return block list. +// GetBlocks returns block list. func (c *Client) GetBlocks(ctx context.Context, pg *Pagination) ([]*Account, error) { var accounts []*Account err := c.doAPI(ctx, http.MethodGet, "/api/v1/blocks", nil, &accounts, pg) @@ -181,7 +181,7 @@ func (c *Client) GetBlocks(ctx context.Context, pg *Pagination) ([]*Account, err return accounts, nil } -// Relationship hold information for relation-ship to the account. +// Relationship holds information for relationship to the account. type Relationship struct { ID ID `json:"id"` Following bool `json:"following"` @@ -195,7 +195,7 @@ type Relationship struct { Endorsed bool `json:"endorsed"` } -// AccountFollow follow the account. +// AccountFollow follows the account. func (c *Client) AccountFollow(ctx context.Context, id ID) (*Relationship, error) { var relationship Relationship err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/accounts/%s/follow", url.PathEscape(string(id))), nil, &relationship, nil) @@ -205,7 +205,7 @@ func (c *Client) AccountFollow(ctx context.Context, id ID) (*Relationship, error return &relationship, nil } -// AccountUnfollow unfollow the account. +// AccountUnfollow unfollows the account. func (c *Client) AccountUnfollow(ctx context.Context, id ID) (*Relationship, error) { var relationship Relationship err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/accounts/%s/unfollow", url.PathEscape(string(id))), nil, &relationship, nil) @@ -215,7 +215,7 @@ func (c *Client) AccountUnfollow(ctx context.Context, id ID) (*Relationship, err return &relationship, nil } -// AccountBlock block the account. +// AccountBlock blocks the account. func (c *Client) AccountBlock(ctx context.Context, id ID) (*Relationship, error) { var relationship Relationship err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/accounts/%s/block", url.PathEscape(string(id))), nil, &relationship, nil) @@ -225,7 +225,7 @@ func (c *Client) AccountBlock(ctx context.Context, id ID) (*Relationship, error) return &relationship, nil } -// AccountUnblock unblock the account. +// AccountUnblock unblocks the account. func (c *Client) AccountUnblock(ctx context.Context, id ID) (*Relationship, error) { var relationship Relationship err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/accounts/%s/unblock", url.PathEscape(string(id))), nil, &relationship, nil) @@ -235,7 +235,7 @@ func (c *Client) AccountUnblock(ctx context.Context, id ID) (*Relationship, erro return &relationship, nil } -// AccountMute mute the account. +// AccountMute mutes the account. func (c *Client) AccountMute(ctx context.Context, id ID) (*Relationship, error) { var relationship Relationship err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/accounts/%s/mute", url.PathEscape(string(id))), nil, &relationship, nil) @@ -245,7 +245,7 @@ func (c *Client) AccountMute(ctx context.Context, id ID) (*Relationship, error) return &relationship, nil } -// AccountUnmute unmute the account. +// AccountUnmute unmutes the account. func (c *Client) AccountUnmute(ctx context.Context, id ID) (*Relationship, error) { var relationship Relationship err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/accounts/%s/unmute", url.PathEscape(string(id))), nil, &relationship, nil) @@ -255,7 +255,7 @@ func (c *Client) AccountUnmute(ctx context.Context, id ID) (*Relationship, error return &relationship, nil } -// GetAccountRelationships return relationship for the account. +// GetAccountRelationships returns relationship for the account. func (c *Client) GetAccountRelationships(ctx context.Context, ids []string) ([]*Relationship, error) { params := url.Values{} for _, id := range ids { @@ -270,7 +270,7 @@ func (c *Client) GetAccountRelationships(ctx context.Context, ids []string) ([]* return relationships, nil } -// AccountsSearch search accounts by query. +// AccountsSearch searches accounts by query. func (c *Client) AccountsSearch(ctx context.Context, q string, limit int64) ([]*Account, error) { params := url.Values{} params.Set("q", q) @@ -284,7 +284,7 @@ func (c *Client) AccountsSearch(ctx context.Context, q string, limit int64) ([]* return accounts, nil } -// FollowRemoteUser send follow-request. +// FollowRemoteUser sends follow-request. func (c *Client) FollowRemoteUser(ctx context.Context, uri string) (*Account, error) { params := url.Values{} params.Set("uri", uri) @@ -297,7 +297,7 @@ func (c *Client) FollowRemoteUser(ctx context.Context, uri string) (*Account, er return &account, nil } -// GetFollowRequests return follow-requests. +// GetFollowRequests returns follow requests. func (c *Client) GetFollowRequests(ctx context.Context, pg *Pagination) ([]*Account, error) { var accounts []*Account err := c.doAPI(ctx, http.MethodGet, "/api/v1/follow_requests", nil, &accounts, pg) @@ -307,12 +307,12 @@ func (c *Client) GetFollowRequests(ctx context.Context, pg *Pagination) ([]*Acco return accounts, nil } -// FollowRequestAuthorize is authorize the follow request of user with id. +// FollowRequestAuthorize authorizes the follow request of user with id. func (c *Client) FollowRequestAuthorize(ctx context.Context, id ID) error { return c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/follow_requests/%s/authorize", url.PathEscape(string(id))), nil, nil, nil) } -// FollowRequestReject is rejects the follow request of user with id. +// FollowRequestReject rejects the follow request of user with id. func (c *Client) FollowRequestReject(ctx context.Context, id ID) error { return c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/follow_requests/%s/reject", url.PathEscape(string(id))), nil, nil, nil) } diff --git a/apps.go b/apps.go index d113909..c885ec9 100644 --- a/apps.go +++ b/apps.go @@ -27,7 +27,7 @@ type AppConfig struct { Website string } -// Application is mastodon application. +// Application is a mastodon application. type Application struct { ID ID `json:"id"` RedirectURI string `json:"redirect_uri"` diff --git a/instance.go b/instance.go index d74322f..672120c 100644 --- a/instance.go +++ b/instance.go @@ -5,7 +5,7 @@ import ( "net/http" ) -// Instance hold information for mastodon instance. +// Instance holds information for a mastodon instance. type Instance struct { URI string `json:"uri"` Title string `json:"title"` @@ -19,14 +19,14 @@ type Instance struct { ContactAccount *Account `json:"contact_account"` } -// InstanceStats hold information for mastodon instance stats. +// InstanceStats holds information for mastodon instance stats. type InstanceStats struct { UserCount int64 `json:"user_count"` StatusCount int64 `json:"status_count"` DomainCount int64 `json:"domain_count"` } -// GetInstance return Instance. +// GetInstance returns Instance. func (c *Client) GetInstance(ctx context.Context) (*Instance, error) { var instance Instance err := c.doAPI(ctx, http.MethodGet, "/api/v1/instance", nil, &instance, nil) @@ -36,7 +36,7 @@ func (c *Client) GetInstance(ctx context.Context) (*Instance, error) { return &instance, nil } -// WeeklyActivity hold information for mastodon weekly activity. +// WeeklyActivity holds information for mastodon weekly activity. type WeeklyActivity struct { Week Unixtime `json:"week"` Statuses int64 `json:"statuses,string"` @@ -44,7 +44,7 @@ type WeeklyActivity struct { Registrations int64 `json:"registrations,string"` } -// GetInstanceActivity return instance activity. +// GetInstanceActivity returns instance activity. func (c *Client) GetInstanceActivity(ctx context.Context) ([]*WeeklyActivity, error) { var activity []*WeeklyActivity err := c.doAPI(ctx, http.MethodGet, "/api/v1/instance/activity", nil, &activity, nil) @@ -54,7 +54,7 @@ func (c *Client) GetInstanceActivity(ctx context.Context) ([]*WeeklyActivity, er return activity, nil } -// GetInstancePeers return instance peers. +// GetInstancePeers returns instance peers. func (c *Client) GetInstancePeers(ctx context.Context) ([]string, error) { var peers []string err := c.doAPI(ctx, http.MethodGet, "/api/v1/instance/peers", nil, &peers, nil) diff --git a/mastodon.go b/mastodon.go index 5b43308..0706981 100644 --- a/mastodon.go +++ b/mastodon.go @@ -128,7 +128,7 @@ func (c *Client) doAPI(ctx context.Context, method string, uri string, params in return json.NewDecoder(resp.Body).Decode(&res) } -// NewClient return new mastodon API client. +// NewClient returns a new mastodon API client. func NewClient(config *Config) *Client { return &Client{ Client: *http.DefaultClient, @@ -136,7 +136,7 @@ func NewClient(config *Config) *Client { } } -// Authenticate get access-token to the API. +// Authenticate gets access-token to the API. func (c *Client) Authenticate(ctx context.Context, username, password string) error { params := url.Values{ "client_id": {c.Config.ClientID}, @@ -222,7 +222,7 @@ const ( VisibilityDirectMessage = "direct" ) -// Toot is struct to post status. +// Toot is a struct to post status. type Toot struct { Status string `json:"status"` InReplyToID ID `json:"in_reply_to_id"` diff --git a/notification.go b/notification.go index b24b9df..fa0cab9 100644 --- a/notification.go +++ b/notification.go @@ -12,7 +12,7 @@ import ( "time" ) -// Notification hold information for mastodon notification. +// Notification holds information for a mastodon notification. type Notification struct { ID ID `json:"id"` Type string `json:"type"` @@ -35,7 +35,7 @@ type PushAlerts struct { Mention *Sbool `json:"mention"` } -// GetNotifications return notifications. +// GetNotifications returns notifications. func (c *Client) GetNotifications(ctx context.Context, pg *Pagination) ([]*Notification, error) { var notifications []*Notification err := c.doAPI(ctx, http.MethodGet, "/api/v1/notifications", nil, ¬ifications, pg) @@ -45,7 +45,7 @@ func (c *Client) GetNotifications(ctx context.Context, pg *Pagination) ([]*Notif return notifications, nil } -// GetNotification return notification. +// GetNotification returns notification. func (c *Client) GetNotification(ctx context.Context, id ID) (*Notification, error) { var notification Notification err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/notifications/%v", id), nil, ¬ification, nil) @@ -60,7 +60,7 @@ func (c *Client) DismissNotification(ctx context.Context, id ID) error { return c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/notifications/%v/dismiss", id), nil, nil, nil) } -// ClearNotifications clear notifications. +// ClearNotifications clears notifications. func (c *Client) ClearNotifications(ctx context.Context) error { return c.doAPI(ctx, http.MethodPost, "/api/v1/notifications/clear", nil, nil, nil) } diff --git a/polls.go b/polls.go index e2a45f3..16be421 100644 --- a/polls.go +++ b/polls.go @@ -8,7 +8,7 @@ import ( "time" ) -// Poll hold information for mastodon polls. +// Poll holds information for mastodon polls. type Poll struct { ID ID `json:"id"` ExpiresAt time.Time `json:"expires_at"` @@ -22,13 +22,13 @@ type Poll struct { Emojis []Emoji `json:"emojis"` } -// Poll hold information for a mastodon poll option. +// Poll holds information for a mastodon poll option. type PollOption struct { Title string `json:"title"` VotesCount int64 `json:"votes_count"` } -// GetPoll return poll specified by id. +// GetPoll returns poll specified by id. func (c *Client) GetPoll(ctx context.Context, id ID) (*Poll, error) { var poll Poll err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/polls/%s", id), nil, &poll, nil) diff --git a/report.go b/report.go index 94ae0dc..662c16a 100644 --- a/report.go +++ b/report.go @@ -6,13 +6,13 @@ import ( "net/url" ) -// Report hold information for mastodon report. +// Report holds information for a mastodon report. type Report struct { ID int64 `json:"id"` ActionTaken bool `json:"action_taken"` } -// GetReports return report of the current user. +// GetReports returns report of the current user. func (c *Client) GetReports(ctx context.Context) ([]*Report, error) { var reports []*Report err := c.doAPI(ctx, http.MethodGet, "/api/v1/reports", nil, &reports, nil) diff --git a/status.go b/status.go index 5cdbf22..1e8f590 100644 --- a/status.go +++ b/status.go @@ -45,13 +45,13 @@ type Status struct { Pinned interface{} `json:"pinned"` } -// Context hold information for mastodon context. +// Context holds information for a mastodon context. type Context struct { Ancestors []*Status `json:"ancestors"` Descendants []*Status `json:"descendants"` } -// Card hold information for mastodon card. +// Card holds information for a mastodon card. type Card struct { URL string `json:"url"` Title string `json:"title"` @@ -67,7 +67,7 @@ type Card struct { Height int64 `json:"height"` } -// Conversation hold information for mastodon conversation. +// Conversation holds information for a mastodon conversation. type Conversation struct { ID ID `json:"id"` Accounts []*Account `json:"accounts"` @@ -140,7 +140,7 @@ func (m *Media) bodyAndContentType() (io.Reader, string, error) { return &buf, mw.FormDataContentType(), nil } -// GetFavourites return the favorite list of the current user. +// GetFavourites returns the favorite list of the current user. func (c *Client) GetFavourites(ctx context.Context, pg *Pagination) ([]*Status, error) { var statuses []*Status err := c.doAPI(ctx, http.MethodGet, "/api/v1/favourites", nil, &statuses, pg) @@ -150,7 +150,7 @@ func (c *Client) GetFavourites(ctx context.Context, pg *Pagination) ([]*Status, return statuses, nil } -// GetBookmarks return the bookmark list of the current user. +// GetBookmarks returns the bookmark list of the current user. func (c *Client) GetBookmarks(ctx context.Context, pg *Pagination) ([]*Status, error) { var statuses []*Status err := c.doAPI(ctx, http.MethodGet, "/api/v1/bookmarks", nil, &statuses, pg) @@ -160,7 +160,7 @@ func (c *Client) GetBookmarks(ctx context.Context, pg *Pagination) ([]*Status, e return statuses, nil } -// GetStatus return status specified by id. +// GetStatus returns status specified by id. func (c *Client) GetStatus(ctx context.Context, id ID) (*Status, error) { var status Status err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/statuses/%s", id), nil, &status, nil) @@ -170,7 +170,7 @@ func (c *Client) GetStatus(ctx context.Context, id ID) (*Status, error) { return &status, nil } -// GetStatusContext return status specified by id. +// GetStatusContext returns status specified by id. func (c *Client) GetStatusContext(ctx context.Context, id ID) (*Context, error) { var context Context err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/statuses/%s/context", id), nil, &context, nil) @@ -180,7 +180,7 @@ func (c *Client) GetStatusContext(ctx context.Context, id ID) (*Context, error) return &context, nil } -// GetStatusCard return status specified by id. +// GetStatusCard returns status specified by id. func (c *Client) GetStatusCard(ctx context.Context, id ID) (*Card, error) { var card Card err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/statuses/%s/card", id), nil, &card, nil) @@ -210,7 +210,7 @@ func (c *Client) GetFavouritedBy(ctx context.Context, id ID, pg *Pagination) ([] return accounts, nil } -// Reblog is reblog the toot of id and return status of reblog. +// Reblog reblogs the toot of id and returns status of reblog. func (c *Client) Reblog(ctx context.Context, id ID) (*Status, error) { var status Status err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/statuses/%s/reblog", id), nil, &status, nil) @@ -220,7 +220,7 @@ func (c *Client) Reblog(ctx context.Context, id ID) (*Status, error) { return &status, nil } -// Unreblog is unreblog the toot of id and return status of the original toot. +// Unreblog unreblogs the toot of id and returns status of the original toot. func (c *Client) Unreblog(ctx context.Context, id ID) (*Status, error) { var status Status err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/statuses/%s/unreblog", id), nil, &status, nil) @@ -230,7 +230,7 @@ func (c *Client) Unreblog(ctx context.Context, id ID) (*Status, error) { return &status, nil } -// Favourite is favourite the toot of id and return status of the favourite toot. +// Favourite favourites the toot of id and returns status of the favourite toot. func (c *Client) Favourite(ctx context.Context, id ID) (*Status, error) { var status Status err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/statuses/%s/favourite", id), nil, &status, nil) @@ -240,7 +240,7 @@ func (c *Client) Favourite(ctx context.Context, id ID) (*Status, error) { return &status, nil } -// Unfavourite is unfavourite the toot of id and return status of the unfavourite toot. +// Unfavourite unfavourites the toot of id and returns status of the unfavourite toot. func (c *Client) Unfavourite(ctx context.Context, id ID) (*Status, error) { var status Status err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/statuses/%s/unfavourite", id), nil, &status, nil) @@ -250,7 +250,7 @@ func (c *Client) Unfavourite(ctx context.Context, id ID) (*Status, error) { return &status, nil } -// Bookmark is bookmark the toot of id and return status of the bookmark toot. +// Bookmark bookmarks the toot of id and returns status of the bookmark toot. func (c *Client) Bookmark(ctx context.Context, id ID) (*Status, error) { var status Status err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/statuses/%s/bookmark", id), nil, &status, nil) diff --git a/streaming.go b/streaming.go index 615efec..2439d67 100644 --- a/streaming.go +++ b/streaming.go @@ -13,32 +13,32 @@ import ( "strings" ) -// UpdateEvent is struct for passing status event to app. +// UpdateEvent is a struct for passing status event to app. type UpdateEvent struct { Status *Status `json:"status"` } func (e *UpdateEvent) event() {} -// NotificationEvent is struct for passing notification event to app. +// NotificationEvent is a struct for passing notification event to app. type NotificationEvent struct { Notification *Notification `json:"notification"` } func (e *NotificationEvent) event() {} -// DeleteEvent is struct for passing deletion event to app. +// DeleteEvent is a struct for passing deletion event to app. type DeleteEvent struct{ ID ID } func (e *DeleteEvent) event() {} -// ErrorEvent is struct for passing errors to app. +// ErrorEvent is a struct for passing errors to app. type ErrorEvent struct{ err error } func (e *ErrorEvent) event() {} func (e *ErrorEvent) Error() string { return e.err.Error() } -// Event is interface passing events to app. +// Event is an interface passing events to app. type Event interface { event() } @@ -150,12 +150,12 @@ func (c *Client) doStreaming(req *http.Request, q chan Event) { } } -// StreamingUser return channel to read events on home. +// StreamingUser returns a channel to read events on home. func (c *Client) StreamingUser(ctx context.Context) (chan Event, error) { return c.streaming(ctx, "user", nil) } -// StreamingPublic return channel to read events on public. +// StreamingPublic returns a channel to read events on public. func (c *Client) StreamingPublic(ctx context.Context, isLocal bool) (chan Event, error) { p := "public" if isLocal { @@ -165,7 +165,7 @@ func (c *Client) StreamingPublic(ctx context.Context, isLocal bool) (chan Event, return c.streaming(ctx, p, nil) } -// StreamingHashtag return channel to read events on tagged timeline. +// StreamingHashtag returns a channel to read events on tagged timeline. func (c *Client) StreamingHashtag(ctx context.Context, tag string, isLocal bool) (chan Event, error) { params := url.Values{} params.Set("tag", tag) @@ -178,7 +178,7 @@ func (c *Client) StreamingHashtag(ctx context.Context, tag string, isLocal bool) return c.streaming(ctx, p, params) } -// StreamingList return channel to read events on a list. +// StreamingList returns a channel to read events on a list. func (c *Client) StreamingList(ctx context.Context, id ID) (chan Event, error) { params := url.Values{} params.Set("list", string(id)) @@ -186,7 +186,7 @@ func (c *Client) StreamingList(ctx context.Context, id ID) (chan Event, error) { return c.streaming(ctx, "list", params) } -// StreamingDirect return channel to read events on a direct messages. +// StreamingDirect returns a channel to read events on a direct messages. func (c *Client) StreamingDirect(ctx context.Context) (chan Event, error) { return c.streaming(ctx, "direct", nil) }