mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2025-05-10 13:58:46 +00:00
Just merge with upstream/master
This commit is contained in:
commit
fa5eaa4442
8 changed files with 66 additions and 57 deletions
|
@ -131,10 +131,7 @@ func RegisterAccount(ctx context.Context, instance string, reason string, userna
|
|||
func (c *Client) GetAccount(ctx context.Context, id string) (*Account, error) {
|
||||
var account Account
|
||||
params := url.Values{}
|
||||
if account.Pleroma != nil {
|
||||
account.MastodonAccount = false
|
||||
params.Set("with_relationships", "1")
|
||||
}
|
||||
params.Set("with_relationships", strconv.FormatBool(true))
|
||||
err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/accounts/%s", url.PathEscape(string(id))), params, &account, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -361,11 +358,10 @@ func (c *Client) AccountUnblock(ctx context.Context, id string) (*Relationship,
|
|||
}
|
||||
|
||||
// AccountMute mute the account.
|
||||
func (c *Client) AccountMute(ctx context.Context, id string, notifications *bool) (*Relationship, error) {
|
||||
func (c *Client) AccountMute(ctx context.Context, id string, notifications bool, duration int) (*Relationship, error) {
|
||||
params := url.Values{}
|
||||
if notifications != nil {
|
||||
params.Set("notifications", strconv.FormatBool(*notifications))
|
||||
}
|
||||
params.Set("notifications", strconv.FormatBool(notifications))
|
||||
params.Set("duration", strconv.Itoa(duration))
|
||||
var relationship Relationship
|
||||
err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/accounts/%s/mute", url.PathEscape(string(id))), params, &relationship, nil)
|
||||
if err != nil {
|
||||
|
|
|
@ -72,7 +72,6 @@ type Status struct {
|
|||
MediaAttachments []Attachment `json:"media_attachments"`
|
||||
Mentions []Mention `json:"mentions"`
|
||||
Tags []Tag `json:"tags"`
|
||||
Card *Card `json:"card"`
|
||||
Application Application `json:"application"`
|
||||
Language string `json:"language"`
|
||||
Pinned interface{} `json:"pinned"`
|
||||
|
@ -93,22 +92,6 @@ type Context struct {
|
|||
Descendants []*Status `json:"descendants"`
|
||||
}
|
||||
|
||||
// Card hold information for mastodon card.
|
||||
type Card struct {
|
||||
URL string `json:"url"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Image string `json:"image"`
|
||||
Type string `json:"type"`
|
||||
AuthorName string `json:"author_name"`
|
||||
AuthorURL string `json:"author_url"`
|
||||
ProviderName string `json:"provider_name"`
|
||||
ProviderURL string `json:"provider_url"`
|
||||
HTML string `json:"html"`
|
||||
Width int64 `json:"width"`
|
||||
Height int64 `json:"height"`
|
||||
}
|
||||
|
||||
// GetFavourites return the favorite list of the current user.
|
||||
func (c *Client) GetFavourites(ctx context.Context, pg *Pagination) ([]*Status, error) {
|
||||
var statuses []*Status
|
||||
|
@ -139,16 +122,6 @@ func (c *Client) GetStatusContext(ctx context.Context, id string) (*Context, err
|
|||
return &context, nil
|
||||
}
|
||||
|
||||
// GetStatusCard return status specified by id.
|
||||
func (c *Client) GetStatusCard(ctx context.Context, id string) (*Card, error) {
|
||||
var card Card
|
||||
err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/statuses/%s/card", id), nil, &card, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &card, nil
|
||||
}
|
||||
|
||||
// GetRebloggedBy returns the account list of the user who reblogged the toot of id.
|
||||
func (c *Client) GetRebloggedBy(ctx context.Context, id string, pg *Pagination) ([]*Account, error) {
|
||||
var accounts []*Account
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue