SearchAccounts: Add 'following' parameter
authorMikael Berthe <mikael@lilotux.net>
Mon, 19 Mar 2018 14:48:00 +0100
changeset 206 9197fdf25388
parent 205 b27e7d229fdd
child 207 301d5b94be3f
SearchAccounts: Add 'following' parameter
account.go
--- a/account.go	Mon Mar 19 13:16:44 2018 +0100
+++ b/account.go	Mon Mar 19 14:48:00 2018 +0100
@@ -26,6 +26,9 @@
 	// The ID is used for most commands
 	ID int64
 
+	// Following can be set to true to limit a search to "following" accounts
+	Following bool
+
 	// The Q field (query) is used when searching for accounts
 	Q string
 
@@ -149,6 +152,9 @@
 	params := make(apiCallParams)
 	if op == "search" {
 		params["q"] = opts.Q
+		if opts.Following {
+			params["following"] = "true"
+		}
 	}
 
 	return mc.getMultipleAccounts(endPoint, params, lopt)
@@ -299,8 +305,8 @@
 
 // SearchAccounts returns a list of accounts matching the query string
 // The lopt parameter is optional (can be nil) or can be used to set a limit.
-func (mc *Client) SearchAccounts(query string, lopt *LimitParams) ([]Account, error) {
-	o := &getAccountsOptions{Q: query, Limit: lopt}
+func (mc *Client) SearchAccounts(query string, following bool, lopt *LimitParams) ([]Account, error) {
+	o := &getAccountsOptions{Q: query, Limit: lopt, Following: following}
 	return mc.getMultipleAccountsHelper("search", o)
 }