-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathsearch.go
68 lines (60 loc) · 2.54 KB
/
search.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package search
// Query struct includes the search query.
type Query struct {
// Expression is the (Lucene-like) string expression specifying the search query.
// If not provided then all resources are listed (up to MaxResults).
Expression string `json:"expression,omitempty"`
// SortBy is the the field to sort by. You can specify more than one SortBy parameter; results will be sorted
// according to the order of the fields provided.
SortBy []SortByField `json:"sort_by,omitempty"`
// Aggregate is the the name of a field (attribute) for which an aggregation count should be calculated and returned in the response.
// (Tier 2 only)
// You can specify more than one aggregate parameter.
// For aggregation fields without discrete values, the results are divided into categories.
Aggregate []Aggregation `json:"aggregate,omitempty"`
// WithField contains names of additional asset attributes to include for each asset in the response.
WithField []WithField `json:"with_field,omitempty"`
// MaxResults is the maximum number of results to return. Default 50. Maximum 500.
MaxResults int `json:"max_results,omitempty"`
// NextCursor value is returned as part of the response when a search request has more results to return than MaxResults.
// You can then specify this value as the NextCursor parameter of the following request.
NextCursor string `json:"next_cursor,omitempty"`
}
// Aggregation is the aggregation field.
type Aggregation = string
const (
// AssetType aggregation field.
AssetType Aggregation = "resource_type"
// DeliveryType aggregation field.
DeliveryType = "type"
// Pixels aggregation field. Only the image assets in the response are aggregated.
Pixels = "pixels"
// Duration aggregation field. Only the video assets in the response are aggregated.
Duration = "duration"
// Format aggregation field.
Format = "format"
// Bytes aggregation field.
Bytes = "bytes"
)
// WithField is the name of the addition filed to include in result.
type WithField = string
const (
// ContextField is the context field.
ContextField WithField = "context"
// TagsField is the tags field.
TagsField = "tags"
// ImageMetadataField is the image metadata field.
ImageMetadataField = "image_metadata"
// ImageAnalysisField is the image analysis field.
ImageAnalysisField = "image_analysis"
)
// Direction is the sorting direction.
type Direction string
const (
// Ascending direction.
Ascending Direction = "asc"
// Descending direction.
Descending = "desc"
)
// SortByField is the the field to sort by and direction.
type SortByField map[string]Direction