# HG changeset patch # User Mikael Berthe # Date 1521467280 -3600 # Node ID 9197fdf2538851448358c60ad1a67cab9a133b92 # Parent b27e7d229fddc9f9503b983950c9e3e12d7038f9 SearchAccounts: Add 'following' parameter diff -r b27e7d229fdd -r 9197fdf25388 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) }