api/user.go
func (a *API) SearchUsers(filterCriteria *SearchFilterType) (*[]User, 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.FetchUsers()
	}

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

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

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

	return &users, nil
}
func (a *API) SearchUsers(filterCriteria *SearchFilterType) (*[]User, 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.FetchUsers()
	}

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

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

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

	return &users, nil
}
func ( a * API ) SearchUsers ( filterCriteria * SearchFilterType ) ( * [ ] User , 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 . FetchUsers ( ) } reqURL := url . URL { Path : config . UserPrefix , RawQuery : q . Encode ( ) , } result , err := a . Get ( reqURL . String ( ) ) if err != nil { return nil , fmt . Errorf ( " " , err ) } var users [ ] User if err := json . Unmarshal ( result , & users ) ; err != nil { return nil , err } return & users , nil }
// SearchUsers returns users matching a filter (search queries
// are not suppoted by the user endpoint). Pass nil as filter for all
// users available to the API Token.
SearchUsers returns users matching a filter ( search queries are not suppoted by the user endpoint ) . Pass nil as filter for all users available to the API Token .