func (a *API) SearchMetrics(searchCriteria *SearchQueryType, filterCriteria *SearchFilterType) (*[]Metric, error) {
	q := url.Values{}

	if searchCriteria != nil && *searchCriteria != "" {
		q.Set("search", string(*searchCriteria))
	}

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

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

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

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

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

	return &metrics, nil
}
// SearchMetrics returns metrics matching the specified search query
// and/or filter. If nil is passed for both parameters all metrics
// will be returned.
SearchMetrics returns metrics matching the specified search query
and/or filter. If nil is passed for both parameters all metrics
will be returned.
// SearchMetrics returns metrics matching the specified search query // and / or filter . If nil is passed for both parameters all metrics // will be returned .
func (a *API) SearchMetrics(searchCriteria *SearchQueryType, filterCriteria *SearchFilterType) (*[]Metric, error) {
	q := url.Values{}
	if searchCriteria != nil && *searchCriteria != "" {
		q.Set("search", string(*searchCriteria))
	}
	if filterCriteria != nil && len(*filterCriteria) > 0 {
		for filter, criteria := range *filterCriteria {
			for _, val := range criteria {
				q.Add(filter, val)
			}
		}
	}
	if q.Encode() == "" {
		return a.FetchMetrics()
	}
	reqURL := url.URL{
		Path:     config.MetricPrefix,
		RawQuery: q.Encode(),
	}
	result, err := a.Get(reqURL.String())
	if err != nil {
		return nil, fmt.Errorf("[ERROR] API call error %+v", err)
	}
	var metrics []Metric
	if err := json.Unmarshal(result, &metrics); err != nil {
		return nil, err
	}
	return &metrics, nil
}
func ( a * API ) SearchMetrics ( searchCriteria * SearchQueryType , filterCriteria * SearchFilterType ) ( * [ ] Metric , error ) { q := url . Values { } if searchCriteria != nil && * searchCriteria != " " { q . Set ( " " , string ( * searchCriteria ) ) } if filterCriteria != nil && len ( * filterCriteria ) > 0 { for filter , criteria := range * filterCriteria { for _ , val := range criteria { q . Add ( filter , val ) } } } if q . Encode ( ) == " " { return a . FetchMetrics ( ) } reqURL := url . URL { Path : config . MetricPrefix , RawQuery : q . Encode ( ) , } result , err := a . Get ( reqURL . String ( ) ) if err != nil { return nil , fmt . Errorf ( " " , err ) } var metrics [ ] Metric if err := json . Unmarshal ( result , & metrics ) ; err != nil { return nil , err } return & metrics , nil }
SearchMetrics returns metrics matching the specified search query
and/or filter.
SearchMetrics returns metrics matching the specified search query and / or filter .