mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-10-03 01:15:11 -04:00
First tagged release carrying the merged search spec: the search query endpoint with aggregations (metricDefinition/searchMetric, geohashDefinition, aggregationFilterToken), sortProperty and the auth-guest additions.
342 lines
11 KiB
Go
342 lines
11 KiB
Go
/*
|
|
Libre Graph API
|
|
|
|
Libre Graph is a free API for cloud collaboration inspired by the MS Graph API.
|
|
|
|
API version: v1.0.8
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
package libregraph
|
|
|
|
import (
|
|
"encoding/json"
|
|
"bytes"
|
|
"fmt"
|
|
)
|
|
|
|
// checks if the AggregationOption type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &AggregationOption{}
|
|
|
|
// AggregationOption Specifies an aggregation that should be computed and returned alongside search results. Follows the [MS Graph aggregationOption](https://learn.microsoft.com/en-us/graph/api/resources/aggregationoption) resource type. For string fields, terms aggregations return the distinct values and their counts. For numeric and date fields, range aggregations can be defined using the `ranges` property of `bucketDefinition`. At most one of `bucketDefinition`, `@libre.graph.metricDefinition` and `@libre.graph.geohashDefinition` may be set; requests specifying more than one are rejected with `invalidRequest`.
|
|
type AggregationOption struct {
|
|
// Specifies the field in the schema of the specified entity type that the aggregation should be computed on. Required. Examples: `audio.artist`, `audio.genre`, `audio.year`, `mimeType`.
|
|
Field string `json:"field"`
|
|
// The number of `searchBucket` resources to be returned. This is optional and only applies to terms and geohash aggregations. For terms aggregations it combines with `bucketDefinition.sortBy` and `bucketDefinition.isDescending` to produce the top N results by count or key; for geohash aggregations it limits the buckets to the top N cells by count. When not specified, all buckets are returned.
|
|
Size *int32 `json:"size,omitempty"`
|
|
BucketDefinition *BucketDefinition `json:"bucketDefinition,omitempty"`
|
|
// Nested aggregations computed within each bucket of this aggregation. Libregraph extension not present in MS Graph. Backends that don't support native composite aggregations (e.g. bleve) emulate them by walking the matched result set; OpenSearch translates them to native composite aggregations.
|
|
LibreGraphSubAggregations []AggregationOption `json:"@libre.graph.subAggregations,omitempty"`
|
|
LibreGraphMetricDefinition *MetricDefinition `json:"@libre.graph.metricDefinition,omitempty"`
|
|
LibreGraphGeohashDefinition *GeohashDefinition `json:"@libre.graph.geohashDefinition,omitempty"`
|
|
}
|
|
|
|
type _AggregationOption AggregationOption
|
|
|
|
// NewAggregationOption instantiates a new AggregationOption object
|
|
// This constructor will assign default values to properties that have it defined,
|
|
// and makes sure properties required by API are set, but the set of arguments
|
|
// will change when the set of required properties is changed
|
|
func NewAggregationOption(field string) *AggregationOption {
|
|
this := AggregationOption{}
|
|
this.Field = field
|
|
return &this
|
|
}
|
|
|
|
// NewAggregationOptionWithDefaults instantiates a new AggregationOption object
|
|
// This constructor will only assign default values to properties that have it defined,
|
|
// but it doesn't guarantee that properties required by API are set
|
|
func NewAggregationOptionWithDefaults() *AggregationOption {
|
|
this := AggregationOption{}
|
|
return &this
|
|
}
|
|
|
|
// GetField returns the Field field value
|
|
func (o *AggregationOption) GetField() string {
|
|
if o == nil {
|
|
var ret string
|
|
return ret
|
|
}
|
|
|
|
return o.Field
|
|
}
|
|
|
|
// GetFieldOk returns a tuple with the Field field value
|
|
// and a boolean to check if the value has been set.
|
|
func (o *AggregationOption) GetFieldOk() (*string, bool) {
|
|
if o == nil {
|
|
return nil, false
|
|
}
|
|
return &o.Field, true
|
|
}
|
|
|
|
// SetField sets field value
|
|
func (o *AggregationOption) SetField(v string) {
|
|
o.Field = v
|
|
}
|
|
|
|
// GetSize returns the Size field value if set, zero value otherwise.
|
|
func (o *AggregationOption) GetSize() int32 {
|
|
if o == nil || IsNil(o.Size) {
|
|
var ret int32
|
|
return ret
|
|
}
|
|
return *o.Size
|
|
}
|
|
|
|
// GetSizeOk returns a tuple with the Size field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *AggregationOption) GetSizeOk() (*int32, bool) {
|
|
if o == nil || IsNil(o.Size) {
|
|
return nil, false
|
|
}
|
|
return o.Size, true
|
|
}
|
|
|
|
// HasSize returns a boolean if a field has been set.
|
|
func (o *AggregationOption) HasSize() bool {
|
|
if o != nil && !IsNil(o.Size) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetSize gets a reference to the given int32 and assigns it to the Size field.
|
|
func (o *AggregationOption) SetSize(v int32) {
|
|
o.Size = &v
|
|
}
|
|
|
|
// GetBucketDefinition returns the BucketDefinition field value if set, zero value otherwise.
|
|
func (o *AggregationOption) GetBucketDefinition() BucketDefinition {
|
|
if o == nil || IsNil(o.BucketDefinition) {
|
|
var ret BucketDefinition
|
|
return ret
|
|
}
|
|
return *o.BucketDefinition
|
|
}
|
|
|
|
// GetBucketDefinitionOk returns a tuple with the BucketDefinition field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *AggregationOption) GetBucketDefinitionOk() (*BucketDefinition, bool) {
|
|
if o == nil || IsNil(o.BucketDefinition) {
|
|
return nil, false
|
|
}
|
|
return o.BucketDefinition, true
|
|
}
|
|
|
|
// HasBucketDefinition returns a boolean if a field has been set.
|
|
func (o *AggregationOption) HasBucketDefinition() bool {
|
|
if o != nil && !IsNil(o.BucketDefinition) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetBucketDefinition gets a reference to the given BucketDefinition and assigns it to the BucketDefinition field.
|
|
func (o *AggregationOption) SetBucketDefinition(v BucketDefinition) {
|
|
o.BucketDefinition = &v
|
|
}
|
|
|
|
// GetLibreGraphSubAggregations returns the LibreGraphSubAggregations field value if set, zero value otherwise.
|
|
func (o *AggregationOption) GetLibreGraphSubAggregations() []AggregationOption {
|
|
if o == nil || IsNil(o.LibreGraphSubAggregations) {
|
|
var ret []AggregationOption
|
|
return ret
|
|
}
|
|
return o.LibreGraphSubAggregations
|
|
}
|
|
|
|
// GetLibreGraphSubAggregationsOk returns a tuple with the LibreGraphSubAggregations field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *AggregationOption) GetLibreGraphSubAggregationsOk() ([]AggregationOption, bool) {
|
|
if o == nil || IsNil(o.LibreGraphSubAggregations) {
|
|
return nil, false
|
|
}
|
|
return o.LibreGraphSubAggregations, true
|
|
}
|
|
|
|
// HasLibreGraphSubAggregations returns a boolean if a field has been set.
|
|
func (o *AggregationOption) HasLibreGraphSubAggregations() bool {
|
|
if o != nil && !IsNil(o.LibreGraphSubAggregations) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetLibreGraphSubAggregations gets a reference to the given []AggregationOption and assigns it to the LibreGraphSubAggregations field.
|
|
func (o *AggregationOption) SetLibreGraphSubAggregations(v []AggregationOption) {
|
|
o.LibreGraphSubAggregations = v
|
|
}
|
|
|
|
// GetLibreGraphMetricDefinition returns the LibreGraphMetricDefinition field value if set, zero value otherwise.
|
|
func (o *AggregationOption) GetLibreGraphMetricDefinition() MetricDefinition {
|
|
if o == nil || IsNil(o.LibreGraphMetricDefinition) {
|
|
var ret MetricDefinition
|
|
return ret
|
|
}
|
|
return *o.LibreGraphMetricDefinition
|
|
}
|
|
|
|
// GetLibreGraphMetricDefinitionOk returns a tuple with the LibreGraphMetricDefinition field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *AggregationOption) GetLibreGraphMetricDefinitionOk() (*MetricDefinition, bool) {
|
|
if o == nil || IsNil(o.LibreGraphMetricDefinition) {
|
|
return nil, false
|
|
}
|
|
return o.LibreGraphMetricDefinition, true
|
|
}
|
|
|
|
// HasLibreGraphMetricDefinition returns a boolean if a field has been set.
|
|
func (o *AggregationOption) HasLibreGraphMetricDefinition() bool {
|
|
if o != nil && !IsNil(o.LibreGraphMetricDefinition) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetLibreGraphMetricDefinition gets a reference to the given MetricDefinition and assigns it to the LibreGraphMetricDefinition field.
|
|
func (o *AggregationOption) SetLibreGraphMetricDefinition(v MetricDefinition) {
|
|
o.LibreGraphMetricDefinition = &v
|
|
}
|
|
|
|
// GetLibreGraphGeohashDefinition returns the LibreGraphGeohashDefinition field value if set, zero value otherwise.
|
|
func (o *AggregationOption) GetLibreGraphGeohashDefinition() GeohashDefinition {
|
|
if o == nil || IsNil(o.LibreGraphGeohashDefinition) {
|
|
var ret GeohashDefinition
|
|
return ret
|
|
}
|
|
return *o.LibreGraphGeohashDefinition
|
|
}
|
|
|
|
// GetLibreGraphGeohashDefinitionOk returns a tuple with the LibreGraphGeohashDefinition field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *AggregationOption) GetLibreGraphGeohashDefinitionOk() (*GeohashDefinition, bool) {
|
|
if o == nil || IsNil(o.LibreGraphGeohashDefinition) {
|
|
return nil, false
|
|
}
|
|
return o.LibreGraphGeohashDefinition, true
|
|
}
|
|
|
|
// HasLibreGraphGeohashDefinition returns a boolean if a field has been set.
|
|
func (o *AggregationOption) HasLibreGraphGeohashDefinition() bool {
|
|
if o != nil && !IsNil(o.LibreGraphGeohashDefinition) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetLibreGraphGeohashDefinition gets a reference to the given GeohashDefinition and assigns it to the LibreGraphGeohashDefinition field.
|
|
func (o *AggregationOption) SetLibreGraphGeohashDefinition(v GeohashDefinition) {
|
|
o.LibreGraphGeohashDefinition = &v
|
|
}
|
|
|
|
func (o AggregationOption) MarshalJSON() ([]byte, error) {
|
|
toSerialize,err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o AggregationOption) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
toSerialize["field"] = o.Field
|
|
if !IsNil(o.Size) {
|
|
toSerialize["size"] = o.Size
|
|
}
|
|
if !IsNil(o.BucketDefinition) {
|
|
toSerialize["bucketDefinition"] = o.BucketDefinition
|
|
}
|
|
if !IsNil(o.LibreGraphSubAggregations) {
|
|
toSerialize["@libre.graph.subAggregations"] = o.LibreGraphSubAggregations
|
|
}
|
|
if !IsNil(o.LibreGraphMetricDefinition) {
|
|
toSerialize["@libre.graph.metricDefinition"] = o.LibreGraphMetricDefinition
|
|
}
|
|
if !IsNil(o.LibreGraphGeohashDefinition) {
|
|
toSerialize["@libre.graph.geohashDefinition"] = o.LibreGraphGeohashDefinition
|
|
}
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *AggregationOption) UnmarshalJSON(data []byte) (err error) {
|
|
// This validates that all required properties are included in the JSON object
|
|
// by unmarshalling the object into a generic map with string keys and checking
|
|
// that every required field exists as a key in the generic map.
|
|
requiredProperties := []string{
|
|
"field",
|
|
}
|
|
|
|
allProperties := make(map[string]interface{})
|
|
|
|
err = json.Unmarshal(data, &allProperties)
|
|
|
|
if err != nil {
|
|
return err;
|
|
}
|
|
|
|
for _, requiredProperty := range(requiredProperties) {
|
|
if _, exists := allProperties[requiredProperty]; !exists {
|
|
return fmt.Errorf("no value given for required property %v", requiredProperty)
|
|
}
|
|
}
|
|
|
|
varAggregationOption := _AggregationOption{}
|
|
|
|
decoder := json.NewDecoder(bytes.NewReader(data))
|
|
decoder.DisallowUnknownFields()
|
|
err = decoder.Decode(&varAggregationOption)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = AggregationOption(varAggregationOption)
|
|
|
|
return err
|
|
}
|
|
|
|
type NullableAggregationOption struct {
|
|
value *AggregationOption
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableAggregationOption) Get() *AggregationOption {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableAggregationOption) Set(val *AggregationOption) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableAggregationOption) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableAggregationOption) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableAggregationOption(val *AggregationOption) *NullableAggregationOption {
|
|
return &NullableAggregationOption{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableAggregationOption) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableAggregationOption) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|
|
|
|
|