api/account.go
func (a *API) SearchAccounts(filterCriteria *SearchFilterType) (*[]Account, error) {
	q := url.Values{}

	if filterCriteria != nil && len(*filterCriteria) > 0 {
		for filter, criteria := range *filterCriteria {
			for _, val := range criteria {
				q.Add(filter, val)
			}
		}
	}

	if q.Encode() == "" {
		return a.FetchAccounts()
	}

	reqURL := url.URL{
		Path:     config.AccountPrefix,
		RawQuery: q.Encode(),
	}

	result, err := a.Get(reqURL.String())
	if err != nil {
		return nil, fmt.Errorf("[ERROR] API call error %+v", err)
	}

	var accounts []Account
	if err := json.Unmarshal(result, &accounts); err != nil {
		return nil, err
	}

	return &accounts, nil
}
func (a *API) SearchAccounts(filterCriteria *SearchFilterType) (*[]Account, error) {
	q := url.Values{}

	if filterCriteria != nil && len(*filterCriteria) > 0 {
		for filter, criteria := range *filterCriteria {
			for _, val := range criteria {
				q.Add(filter, val)
			}
		}
	}

	if q.Encode() == "" {
		return a.FetchAccounts()
	}

	reqURL := url.URL{
		Path:     config.AccountPrefix,
		RawQuery: q.Encode(),
	}

	result, err := a.Get(reqURL.String())
	if err != nil {
		return nil, fmt.Errorf("[ERROR] API call error %+v", err)
	}

	var accounts []Account
	if err := json.Unmarshal(result, &accounts); err != nil {
		return nil, err
	}

	return &accounts, nil
}
// SearchAccounts returns accounts matching a filter (search queries are not
// suppoted by the account endpoint). Pass nil as filter for all accounts the
// API Token can access.