/* 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 SearchQuery type satisfies the MappedNullable interface at compile time var _ MappedNullable = &SearchQuery{} // SearchQuery Represents the search query. Follows the [MS Graph searchQuery](https://learn.microsoft.com/en-us/graph/api/resources/searchquery) resource type. type SearchQuery struct { // The search query string in KQL (Keyword Query Language) format. The query string can contain free-text keywords and property filters. Examples: - `budget report`: free text search - `mediatype:audio`: filter by media type - `audio.artist:\"Saxon\"`: filter by audio metadata - `audio.genre:Rock AND audio.year:1979`: combined filters QueryString string `json:"queryString"` } type _SearchQuery SearchQuery // NewSearchQuery instantiates a new SearchQuery 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 NewSearchQuery(queryString string) *SearchQuery { this := SearchQuery{} this.QueryString = queryString return &this } // NewSearchQueryWithDefaults instantiates a new SearchQuery 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 NewSearchQueryWithDefaults() *SearchQuery { this := SearchQuery{} return &this } // GetQueryString returns the QueryString field value func (o *SearchQuery) GetQueryString() string { if o == nil { var ret string return ret } return o.QueryString } // GetQueryStringOk returns a tuple with the QueryString field value // and a boolean to check if the value has been set. func (o *SearchQuery) GetQueryStringOk() (*string, bool) { if o == nil { return nil, false } return &o.QueryString, true } // SetQueryString sets field value func (o *SearchQuery) SetQueryString(v string) { o.QueryString = v } func (o SearchQuery) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } return json.Marshal(toSerialize) } func (o SearchQuery) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["queryString"] = o.QueryString return toSerialize, nil } func (o *SearchQuery) 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{ "queryString", } 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) } } varSearchQuery := _SearchQuery{} decoder := json.NewDecoder(bytes.NewReader(data)) decoder.DisallowUnknownFields() err = decoder.Decode(&varSearchQuery) if err != nil { return err } *o = SearchQuery(varSearchQuery) return err } type NullableSearchQuery struct { value *SearchQuery isSet bool } func (v NullableSearchQuery) Get() *SearchQuery { return v.value } func (v *NullableSearchQuery) Set(val *SearchQuery) { v.value = val v.isSet = true } func (v NullableSearchQuery) IsSet() bool { return v.isSet } func (v *NullableSearchQuery) Unset() { v.value = nil v.isSet = false } func NewNullableSearchQuery(val *SearchQuery) *NullableSearchQuery { return &NullableSearchQuery{value: val, isSet: true} } func (v NullableSearchQuery) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableSearchQuery) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }