From c390a0c32720f6afe852bc7a3a3f64c3afe9e401 Mon Sep 17 00:00:00 2001
From: r <r@freesoftwareextremist.com>
Date: Fri, 11 Feb 2022 11:18:02 +0000
Subject: Add lists

---
 mastodon/lists.go  | 4 ++--
 mastodon/status.go | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

(limited to 'mastodon')

diff --git a/mastodon/lists.go b/mastodon/lists.go
index d323b79..1b76bdc 100644
--- a/mastodon/lists.go
+++ b/mastodon/lists.go
@@ -90,7 +90,7 @@ func (c *Client) DeleteList(ctx context.Context, id string) error {
 func (c *Client) AddToList(ctx context.Context, list string, accounts ...string) error {
 	params := url.Values{}
 	for _, acct := range accounts {
-		params.Add("account_ids", string(acct))
+		params.Add("account_ids[]", string(acct))
 	}
 
 	return c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/lists/%s/accounts", url.PathEscape(string(list))), params, nil, nil)
@@ -100,7 +100,7 @@ func (c *Client) AddToList(ctx context.Context, list string, accounts ...string)
 func (c *Client) RemoveFromList(ctx context.Context, list string, accounts ...string) error {
 	params := url.Values{}
 	for _, acct := range accounts {
-		params.Add("account_ids", string(acct))
+		params.Add("account_ids[]", string(acct))
 	}
 
 	return c.doAPI(ctx, http.MethodDelete, fmt.Sprintf("/api/v1/lists/%s/accounts", url.PathEscape(string(list))), params, nil, nil)
diff --git a/mastodon/status.go b/mastodon/status.go
index 8b148b3..2fae6ee 100644
--- a/mastodon/status.go
+++ b/mastodon/status.go
@@ -301,7 +301,7 @@ func (c *Client) DeleteStatus(ctx context.Context, id string) error {
 }
 
 // Search search content with query.
-func (c *Client) Search(ctx context.Context, q string, qType string, limit int, resolve bool, offset int, accountID string) (*Results, error) {
+func (c *Client) Search(ctx context.Context, q string, qType string, limit int, resolve bool, offset int, accountID string, following bool) (*Results, error) {
 	var results Results
 	params := url.Values{}
 	params.Set("q", q)
@@ -309,6 +309,7 @@ func (c *Client) Search(ctx context.Context, q string, qType string, limit int,
 	params.Set("limit", fmt.Sprint(limit))
 	params.Set("resolve", fmt.Sprint(resolve))
 	params.Set("offset", fmt.Sprint(offset))
+	params.Set("following", fmt.Sprint(following))
 	if len(accountID) > 0 {
 		params.Set("account_id", accountID)
 	}
-- 
cgit v1.2.3


From 5f688c6318191627775ae44221eb75cb6ed2e905 Mon Sep 17 00:00:00 2001
From: Pete <pete@debu.gs>
Date: Mon, 15 Aug 2022 06:57:41 -0700
Subject: Show BlockedBy on user page

Just show this information. No blockbots required.
---
 mastodon/accounts.go | 1 +
 1 file changed, 1 insertion(+)

(limited to 'mastodon')

diff --git a/mastodon/accounts.go b/mastodon/accounts.go
index df0a3b7..dbd0a48 100644
--- a/mastodon/accounts.go
+++ b/mastodon/accounts.go
@@ -189,6 +189,7 @@ type Relationship struct {
 	Following           bool   `json:"following"`
 	FollowedBy          bool   `json:"followed_by"`
 	Blocking            bool   `json:"blocking"`
+	BlockedBy           bool   `json:"blocked_by"`
 	Muting              bool   `json:"muting"`
 	MutingNotifications bool   `json:"muting_notifications"`
 	Subscribing         bool   `json:"subscribing"`
-- 
cgit v1.2.3


From 68698a9e1afce43ef807d6b5f892ca1c0f905b8a Mon Sep 17 00:00:00 2001
From: r <r@freesoftwareextremist.com>
Date: Fri, 23 Sep 2022 17:08:58 +0000
Subject: Remove unused card field from status

Fixes JSON parsing of posts with incompatible card data.
---
 mastodon/status.go | 27 ---------------------------
 1 file changed, 27 deletions(-)

(limited to 'mastodon')

diff --git a/mastodon/status.go b/mastodon/status.go
index 2fae6ee..f860c31 100644
--- a/mastodon/status.go
+++ b/mastodon/status.go
@@ -56,7 +56,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"`
@@ -77,22 +76,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
@@ -123,16 +106,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
-- 
cgit v1.2.3