/* 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 GeohashDefinition type satisfies the MappedNullable interface at compile time var _ MappedNullable = &GeohashDefinition{} // GeohashDefinition Provides the details of how to compute a geohash-grid aggregation over `field`, which must resolve to a geo-point field (e.g. `location`). When set on an `aggregationOption`, each `searchBucket` of the corresponding `searchAggregation` carries a geohash cell as its `key`, with `count` holding the number of matches in the cell, suitable for density/heatmap rendering. `size` limits the buckets to the top N cells by count. Libregraph extension not present in MS Graph. type GeohashDefinition struct { // The geohash length of the returned cells (1-12); higher means finer cells. Required. Precision int32 `json:"precision"` } type _GeohashDefinition GeohashDefinition // NewGeohashDefinition instantiates a new GeohashDefinition 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 NewGeohashDefinition(precision int32) *GeohashDefinition { this := GeohashDefinition{} this.Precision = precision return &this } // NewGeohashDefinitionWithDefaults instantiates a new GeohashDefinition 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 NewGeohashDefinitionWithDefaults() *GeohashDefinition { this := GeohashDefinition{} return &this } // GetPrecision returns the Precision field value func (o *GeohashDefinition) GetPrecision() int32 { if o == nil { var ret int32 return ret } return o.Precision } // GetPrecisionOk returns a tuple with the Precision field value // and a boolean to check if the value has been set. func (o *GeohashDefinition) GetPrecisionOk() (*int32, bool) { if o == nil { return nil, false } return &o.Precision, true } // SetPrecision sets field value func (o *GeohashDefinition) SetPrecision(v int32) { o.Precision = v } func (o GeohashDefinition) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } return json.Marshal(toSerialize) } func (o GeohashDefinition) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["precision"] = o.Precision return toSerialize, nil } func (o *GeohashDefinition) 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{ "precision", } 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) } } varGeohashDefinition := _GeohashDefinition{} decoder := json.NewDecoder(bytes.NewReader(data)) decoder.DisallowUnknownFields() err = decoder.Decode(&varGeohashDefinition) if err != nil { return err } *o = GeohashDefinition(varGeohashDefinition) return err } type NullableGeohashDefinition struct { value *GeohashDefinition isSet bool } func (v NullableGeohashDefinition) Get() *GeohashDefinition { return v.value } func (v *NullableGeohashDefinition) Set(val *GeohashDefinition) { v.value = val v.isSet = true } func (v NullableGeohashDefinition) IsSet() bool { return v.isSet } func (v *NullableGeohashDefinition) Unset() { v.value = nil v.isSet = false } func NewNullableGeohashDefinition(val *GeohashDefinition) *NullableGeohashDefinition { return &NullableGeohashDefinition{value: val, isSet: true} } func (v NullableGeohashDefinition) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableGeohashDefinition) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }