Merge branch 'master' into resolve

This commit is contained in:
mattn 2022-11-30 08:15:33 +09:00 committed by GitHub
commit 18f084c012
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 155 additions and 186 deletions

View file

@ -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)
@ -298,7 +298,7 @@ func (c *Client) AccountsSearchResolve(ctx context.Context, q string, limit int6
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)
@ -311,7 +311,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)
@ -321,12 +321,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)
}