Files
opencloud/vendor/github.com/opencloud-eu/libre-graph-api-go/model_bucket_definition.go
T
Dominik Schmidt 2a00f7c34a chore: bump libre-graph-api-go to v1.0.8
First tagged release carrying the merged search spec: the search query
endpoint with aggregations (metricDefinition/searchMetric,
geohashDefinition, aggregationFilterToken), sortProperty and the
auth-guest additions.
2026-10-02 12:48:21 +02:00

279 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"
"bytes"
"fmt"
)
// checks if the BucketDefinition type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &BucketDefinition{}
// BucketDefinition Provides the details of how to generate the aggregation buckets in the response. Follows the [MS Graph bucketAggregationDefinition](https://learn.microsoft.com/en-us/graph/api/resources/bucketaggregationdefinition) resource type.
type BucketDefinition struct {
// The possible values are `count` to sort by the number of matches in the aggregation, `keyAsString` to sort alphabetically based on the key in the aggregation, and `keyAsNumber` to sort numerically based on the key in the aggregation. Required.
SortBy string `json:"sortBy"`
// Set to `true` to specify the sort order as descending. Optional, defaults to `false` (ascending).
IsDescending *bool `json:"isDescending,omitempty"`
// The minimum number of items that should be present in the aggregation for the bucket to be returned in the response. Optional, default is 0.
MinimumCount *int32 `json:"minimumCount,omitempty"`
// Specifies the manual ranges to compute the aggregation buckets. This is only valid for non-string facets of date or numeric type. Optional. Follows the [MS Graph bucketAggregationRange](https://learn.microsoft.com/en-us/graph/api/resources/bucketaggregationrange) resource type.
Ranges []BucketAggregationRange `json:"ranges,omitempty"`
}
type _BucketDefinition BucketDefinition
// NewBucketDefinition instantiates a new BucketDefinition 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 NewBucketDefinition(sortBy string) *BucketDefinition {
this := BucketDefinition{}
this.SortBy = sortBy
var isDescending bool = false
this.IsDescending = &isDescending
var minimumCount int32 = 0
this.MinimumCount = &minimumCount
return &this
}
// NewBucketDefinitionWithDefaults instantiates a new BucketDefinition 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 NewBucketDefinitionWithDefaults() *BucketDefinition {
this := BucketDefinition{}
var isDescending bool = false
this.IsDescending = &isDescending
var minimumCount int32 = 0
this.MinimumCount = &minimumCount
return &this
}
// GetSortBy returns the SortBy field value
func (o *BucketDefinition) GetSortBy() string {
if o == nil {
var ret string
return ret
}
return o.SortBy
}
// GetSortByOk returns a tuple with the SortBy field value
// and a boolean to check if the value has been set.
func (o *BucketDefinition) GetSortByOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.SortBy, true
}
// SetSortBy sets field value
func (o *BucketDefinition) SetSortBy(v string) {
o.SortBy = v
}
// GetIsDescending returns the IsDescending field value if set, zero value otherwise.
func (o *BucketDefinition) GetIsDescending() bool {
if o == nil || IsNil(o.IsDescending) {
var ret bool
return ret
}
return *o.IsDescending
}
// GetIsDescendingOk returns a tuple with the IsDescending field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BucketDefinition) GetIsDescendingOk() (*bool, bool) {
if o == nil || IsNil(o.IsDescending) {
return nil, false
}
return o.IsDescending, true
}
// HasIsDescending returns a boolean if a field has been set.
func (o *BucketDefinition) HasIsDescending() bool {
if o != nil && !IsNil(o.IsDescending) {
return true
}
return false
}
// SetIsDescending gets a reference to the given bool and assigns it to the IsDescending field.
func (o *BucketDefinition) SetIsDescending(v bool) {
o.IsDescending = &v
}
// GetMinimumCount returns the MinimumCount field value if set, zero value otherwise.
func (o *BucketDefinition) GetMinimumCount() int32 {
if o == nil || IsNil(o.MinimumCount) {
var ret int32
return ret
}
return *o.MinimumCount
}
// GetMinimumCountOk returns a tuple with the MinimumCount field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BucketDefinition) GetMinimumCountOk() (*int32, bool) {
if o == nil || IsNil(o.MinimumCount) {
return nil, false
}
return o.MinimumCount, true
}
// HasMinimumCount returns a boolean if a field has been set.
func (o *BucketDefinition) HasMinimumCount() bool {
if o != nil && !IsNil(o.MinimumCount) {
return true
}
return false
}
// SetMinimumCount gets a reference to the given int32 and assigns it to the MinimumCount field.
func (o *BucketDefinition) SetMinimumCount(v int32) {
o.MinimumCount = &v
}
// GetRanges returns the Ranges field value if set, zero value otherwise.
func (o *BucketDefinition) GetRanges() []BucketAggregationRange {
if o == nil || IsNil(o.Ranges) {
var ret []BucketAggregationRange
return ret
}
return o.Ranges
}
// GetRangesOk returns a tuple with the Ranges field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BucketDefinition) GetRangesOk() ([]BucketAggregationRange, bool) {
if o == nil || IsNil(o.Ranges) {
return nil, false
}
return o.Ranges, true
}
// HasRanges returns a boolean if a field has been set.
func (o *BucketDefinition) HasRanges() bool {
if o != nil && !IsNil(o.Ranges) {
return true
}
return false
}
// SetRanges gets a reference to the given []BucketAggregationRange and assigns it to the Ranges field.
func (o *BucketDefinition) SetRanges(v []BucketAggregationRange) {
o.Ranges = v
}
func (o BucketDefinition) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o BucketDefinition) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["sortBy"] = o.SortBy
if !IsNil(o.IsDescending) {
toSerialize["isDescending"] = o.IsDescending
}
if !IsNil(o.MinimumCount) {
toSerialize["minimumCount"] = o.MinimumCount
}
if !IsNil(o.Ranges) {
toSerialize["ranges"] = o.Ranges
}
return toSerialize, nil
}
func (o *BucketDefinition) 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{
"sortBy",
}
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)
}
}
varBucketDefinition := _BucketDefinition{}
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
err = decoder.Decode(&varBucketDefinition)
if err != nil {
return err
}
*o = BucketDefinition(varBucketDefinition)
return err
}
type NullableBucketDefinition struct {
value *BucketDefinition
isSet bool
}
func (v NullableBucketDefinition) Get() *BucketDefinition {
return v.value
}
func (v *NullableBucketDefinition) Set(val *BucketDefinition) {
v.value = val
v.isSet = true
}
func (v NullableBucketDefinition) IsSet() bool {
return v.isSet
}
func (v *NullableBucketDefinition) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableBucketDefinition(val *BucketDefinition) *NullableBucketDefinition {
return &NullableBucketDefinition{value: val, isSet: true}
}
func (v NullableBucketDefinition) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableBucketDefinition) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}