mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-11-27 10:34:42 -05: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.
239 lines
8.0 KiB
Go
239 lines
8.0 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"
|
|
)
|
|
|
|
// checks if the SearchBucket type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &SearchBucket{}
|
|
|
|
// SearchBucket Represents a single bucket in a search aggregation result. Follows the [MS Graph searchBucket](https://learn.microsoft.com/en-us/graph/api/resources/searchbucket) resource type.
|
|
type SearchBucket struct {
|
|
// The discrete value of the field that was used to compute the aggregation. For terms aggregations this is the field value. For range aggregations this is a string representation of the range. For geohash aggregations this is a geohash cell.
|
|
Key *string `json:"key,omitempty"`
|
|
// The approximate number of search matches that share the same value specified in the `key` property.
|
|
Count *int64 `json:"count,omitempty"`
|
|
// A token containing the encoded filter that narrows search matches to this bucket. To use it, pass it as part of the `aggregationFilters` property of a subsequent `searchRequest` in the format `{field}:{aggregationFilterToken}`. The filter matches the bucket `key` exactly and case-sensitively, so the narrowed result set is the set of matches counted in this bucket. For terms buckets the token is the key encoded as lowercase hex of its UTF-8 bytes, prefixed with `ǂǂ` (U+01C2 twice) and wrapped in double quotes, e.g. `\"ǂǂ5361786f6e\"` for the key `Saxon`. For range buckets the token is `range({from}, {to})` with the bounds of the matching `bucketAggregationRange`; an open lower bound is written as `min`, an open upper bound as `max` followed by `to=\"le\"`, e.g. `range(min, 1980)`, `range(1980, 1990)` and `range(2010, max, to=\"le\")`. This is the same encoding MS Graph uses. Geohash buckets carry no token; narrow by location through the search query instead.
|
|
AggregationFilterToken *string `json:"aggregationFilterToken,omitempty"`
|
|
// Nested aggregation results, one per sub-aggregation requested on the parent `aggregationOption`. Libregraph extension not present in MS Graph.
|
|
LibreGraphSubAggregations []SearchAggregation `json:"@libre.graph.subAggregations,omitempty"`
|
|
}
|
|
|
|
// NewSearchBucket instantiates a new SearchBucket 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 NewSearchBucket() *SearchBucket {
|
|
this := SearchBucket{}
|
|
return &this
|
|
}
|
|
|
|
// NewSearchBucketWithDefaults instantiates a new SearchBucket 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 NewSearchBucketWithDefaults() *SearchBucket {
|
|
this := SearchBucket{}
|
|
return &this
|
|
}
|
|
|
|
// GetKey returns the Key field value if set, zero value otherwise.
|
|
func (o *SearchBucket) GetKey() string {
|
|
if o == nil || IsNil(o.Key) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Key
|
|
}
|
|
|
|
// GetKeyOk returns a tuple with the Key field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *SearchBucket) GetKeyOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Key) {
|
|
return nil, false
|
|
}
|
|
return o.Key, true
|
|
}
|
|
|
|
// HasKey returns a boolean if a field has been set.
|
|
func (o *SearchBucket) HasKey() bool {
|
|
if o != nil && !IsNil(o.Key) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetKey gets a reference to the given string and assigns it to the Key field.
|
|
func (o *SearchBucket) SetKey(v string) {
|
|
o.Key = &v
|
|
}
|
|
|
|
// GetCount returns the Count field value if set, zero value otherwise.
|
|
func (o *SearchBucket) GetCount() int64 {
|
|
if o == nil || IsNil(o.Count) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.Count
|
|
}
|
|
|
|
// GetCountOk returns a tuple with the Count field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *SearchBucket) GetCountOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.Count) {
|
|
return nil, false
|
|
}
|
|
return o.Count, true
|
|
}
|
|
|
|
// HasCount returns a boolean if a field has been set.
|
|
func (o *SearchBucket) HasCount() bool {
|
|
if o != nil && !IsNil(o.Count) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetCount gets a reference to the given int64 and assigns it to the Count field.
|
|
func (o *SearchBucket) SetCount(v int64) {
|
|
o.Count = &v
|
|
}
|
|
|
|
// GetAggregationFilterToken returns the AggregationFilterToken field value if set, zero value otherwise.
|
|
func (o *SearchBucket) GetAggregationFilterToken() string {
|
|
if o == nil || IsNil(o.AggregationFilterToken) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.AggregationFilterToken
|
|
}
|
|
|
|
// GetAggregationFilterTokenOk returns a tuple with the AggregationFilterToken field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *SearchBucket) GetAggregationFilterTokenOk() (*string, bool) {
|
|
if o == nil || IsNil(o.AggregationFilterToken) {
|
|
return nil, false
|
|
}
|
|
return o.AggregationFilterToken, true
|
|
}
|
|
|
|
// HasAggregationFilterToken returns a boolean if a field has been set.
|
|
func (o *SearchBucket) HasAggregationFilterToken() bool {
|
|
if o != nil && !IsNil(o.AggregationFilterToken) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetAggregationFilterToken gets a reference to the given string and assigns it to the AggregationFilterToken field.
|
|
func (o *SearchBucket) SetAggregationFilterToken(v string) {
|
|
o.AggregationFilterToken = &v
|
|
}
|
|
|
|
// GetLibreGraphSubAggregations returns the LibreGraphSubAggregations field value if set, zero value otherwise.
|
|
func (o *SearchBucket) GetLibreGraphSubAggregations() []SearchAggregation {
|
|
if o == nil || IsNil(o.LibreGraphSubAggregations) {
|
|
var ret []SearchAggregation
|
|
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 *SearchBucket) GetLibreGraphSubAggregationsOk() ([]SearchAggregation, 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 *SearchBucket) HasLibreGraphSubAggregations() bool {
|
|
if o != nil && !IsNil(o.LibreGraphSubAggregations) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetLibreGraphSubAggregations gets a reference to the given []SearchAggregation and assigns it to the LibreGraphSubAggregations field.
|
|
func (o *SearchBucket) SetLibreGraphSubAggregations(v []SearchAggregation) {
|
|
o.LibreGraphSubAggregations = v
|
|
}
|
|
|
|
func (o SearchBucket) MarshalJSON() ([]byte, error) {
|
|
toSerialize,err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o SearchBucket) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if !IsNil(o.Key) {
|
|
toSerialize["key"] = o.Key
|
|
}
|
|
if !IsNil(o.Count) {
|
|
toSerialize["count"] = o.Count
|
|
}
|
|
if !IsNil(o.AggregationFilterToken) {
|
|
toSerialize["aggregationFilterToken"] = o.AggregationFilterToken
|
|
}
|
|
if !IsNil(o.LibreGraphSubAggregations) {
|
|
toSerialize["@libre.graph.subAggregations"] = o.LibreGraphSubAggregations
|
|
}
|
|
return toSerialize, nil
|
|
}
|
|
|
|
type NullableSearchBucket struct {
|
|
value *SearchBucket
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableSearchBucket) Get() *SearchBucket {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableSearchBucket) Set(val *SearchBucket) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableSearchBucket) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableSearchBucket) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableSearchBucket(val *SearchBucket) *NullableSearchBucket {
|
|
return &NullableSearchBucket{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableSearchBucket) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableSearchBucket) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|
|
|
|
|