/* 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 SearchAggregation type satisfies the MappedNullable interface at compile time var _ MappedNullable = &SearchAggregation{} // SearchAggregation Provides the details of a search aggregation in the search response. Follows the [MS Graph searchAggregation](https://learn.microsoft.com/en-us/graph/api/resources/searchaggregation) resource type. type SearchAggregation struct { // Defines the field in the request on which the aggregation was computed. Field *string `json:"field,omitempty"` // Defines the computed buckets for this aggregation. For bucket aggregations they are sorted according to the `sortBy` and `isDescending` specified in the `bucketDefinition` of the corresponding `aggregationOption`; for geohash aggregations they are ordered by `count`, descending. Buckets []SearchBucket `json:"buckets,omitempty"` LibreGraphMetric *SearchMetric `json:"@libre.graph.metric,omitempty"` } // NewSearchAggregation instantiates a new SearchAggregation 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 NewSearchAggregation() *SearchAggregation { this := SearchAggregation{} return &this } // NewSearchAggregationWithDefaults instantiates a new SearchAggregation 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 NewSearchAggregationWithDefaults() *SearchAggregation { this := SearchAggregation{} return &this } // GetField returns the Field field value if set, zero value otherwise. func (o *SearchAggregation) GetField() string { if o == nil || IsNil(o.Field) { var ret string return ret } return *o.Field } // GetFieldOk returns a tuple with the Field field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SearchAggregation) GetFieldOk() (*string, bool) { if o == nil || IsNil(o.Field) { return nil, false } return o.Field, true } // HasField returns a boolean if a field has been set. func (o *SearchAggregation) HasField() bool { if o != nil && !IsNil(o.Field) { return true } return false } // SetField gets a reference to the given string and assigns it to the Field field. func (o *SearchAggregation) SetField(v string) { o.Field = &v } // GetBuckets returns the Buckets field value if set, zero value otherwise. func (o *SearchAggregation) GetBuckets() []SearchBucket { if o == nil || IsNil(o.Buckets) { var ret []SearchBucket return ret } return o.Buckets } // GetBucketsOk returns a tuple with the Buckets field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SearchAggregation) GetBucketsOk() ([]SearchBucket, bool) { if o == nil || IsNil(o.Buckets) { return nil, false } return o.Buckets, true } // HasBuckets returns a boolean if a field has been set. func (o *SearchAggregation) HasBuckets() bool { if o != nil && !IsNil(o.Buckets) { return true } return false } // SetBuckets gets a reference to the given []SearchBucket and assigns it to the Buckets field. func (o *SearchAggregation) SetBuckets(v []SearchBucket) { o.Buckets = v } // GetLibreGraphMetric returns the LibreGraphMetric field value if set, zero value otherwise. func (o *SearchAggregation) GetLibreGraphMetric() SearchMetric { if o == nil || IsNil(o.LibreGraphMetric) { var ret SearchMetric return ret } return *o.LibreGraphMetric } // GetLibreGraphMetricOk returns a tuple with the LibreGraphMetric field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SearchAggregation) GetLibreGraphMetricOk() (*SearchMetric, bool) { if o == nil || IsNil(o.LibreGraphMetric) { return nil, false } return o.LibreGraphMetric, true } // HasLibreGraphMetric returns a boolean if a field has been set. func (o *SearchAggregation) HasLibreGraphMetric() bool { if o != nil && !IsNil(o.LibreGraphMetric) { return true } return false } // SetLibreGraphMetric gets a reference to the given SearchMetric and assigns it to the LibreGraphMetric field. func (o *SearchAggregation) SetLibreGraphMetric(v SearchMetric) { o.LibreGraphMetric = &v } func (o SearchAggregation) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } return json.Marshal(toSerialize) } func (o SearchAggregation) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if !IsNil(o.Field) { toSerialize["field"] = o.Field } if !IsNil(o.Buckets) { toSerialize["buckets"] = o.Buckets } if !IsNil(o.LibreGraphMetric) { toSerialize["@libre.graph.metric"] = o.LibreGraphMetric } return toSerialize, nil } type NullableSearchAggregation struct { value *SearchAggregation isSet bool } func (v NullableSearchAggregation) Get() *SearchAggregation { return v.value } func (v *NullableSearchAggregation) Set(val *SearchAggregation) { v.value = val v.isSet = true } func (v NullableSearchAggregation) IsSet() bool { return v.isSet } func (v *NullableSearchAggregation) Unset() { v.value = nil v.isSet = false } func NewNullableSearchAggregation(val *SearchAggregation) *NullableSearchAggregation { return &NullableSearchAggregation{value: val, isSet: true} } func (v NullableSearchAggregation) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableSearchAggregation) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }