Files
sdk/model_search_request.go

383 lines
9.7 KiB
Go

/*
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
API version: v1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hanzoai
import (
"encoding/json"
)
// checks if the SearchRequest type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &SearchRequest{}
// SearchRequest struct for SearchRequest
type SearchRequest struct {
// DocTypes restricts the semantic leg to a subset of indexed knowledge types.
Doctypes []string `json:"doctypes,omitempty"`
// Index names the lexical index to query. Defaults to \"kb\".
Index *string `json:"index,omitempty"`
// Limit bounds the FUSED result set (default 10, max 50).
Limit *int64 `json:"limit,omitempty"`
// Mode selects the legs: auto (default) | text | semantic | hybrid.
Mode *string `json:"mode,omitempty"`
// Offset pages the fused result set.
Offset *int64 `json:"offset,omitempty"`
// Project narrows to one project scope within the org.
Project *string `json:"project,omitempty"`
// Query is the natural-language or keyword query. Required.
Query *string `json:"query,omitempty"`
AdditionalProperties map[string]interface{}
}
type _SearchRequest SearchRequest
// NewSearchRequest instantiates a new SearchRequest 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 NewSearchRequest() *SearchRequest {
this := SearchRequest{}
return &this
}
// NewSearchRequestWithDefaults instantiates a new SearchRequest 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 NewSearchRequestWithDefaults() *SearchRequest {
this := SearchRequest{}
return &this
}
// GetDoctypes returns the Doctypes field value if set, zero value otherwise.
func (o *SearchRequest) GetDoctypes() []string {
if o == nil || IsNil(o.Doctypes) {
var ret []string
return ret
}
return o.Doctypes
}
// GetDoctypesOk returns a tuple with the Doctypes field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SearchRequest) GetDoctypesOk() ([]string, bool) {
if o == nil || IsNil(o.Doctypes) {
return nil, false
}
return o.Doctypes, true
}
// HasDoctypes returns a boolean if a field has been set.
func (o *SearchRequest) HasDoctypes() bool {
if o != nil && !IsNil(o.Doctypes) {
return true
}
return false
}
// SetDoctypes gets a reference to the given []string and assigns it to the Doctypes field.
func (o *SearchRequest) SetDoctypes(v []string) {
o.Doctypes = v
}
// GetIndex returns the Index field value if set, zero value otherwise.
func (o *SearchRequest) GetIndex() string {
if o == nil || IsNil(o.Index) {
var ret string
return ret
}
return *o.Index
}
// GetIndexOk returns a tuple with the Index field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SearchRequest) GetIndexOk() (*string, bool) {
if o == nil || IsNil(o.Index) {
return nil, false
}
return o.Index, true
}
// HasIndex returns a boolean if a field has been set.
func (o *SearchRequest) HasIndex() bool {
if o != nil && !IsNil(o.Index) {
return true
}
return false
}
// SetIndex gets a reference to the given string and assigns it to the Index field.
func (o *SearchRequest) SetIndex(v string) {
o.Index = &v
}
// GetLimit returns the Limit field value if set, zero value otherwise.
func (o *SearchRequest) GetLimit() int64 {
if o == nil || IsNil(o.Limit) {
var ret int64
return ret
}
return *o.Limit
}
// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SearchRequest) GetLimitOk() (*int64, bool) {
if o == nil || IsNil(o.Limit) {
return nil, false
}
return o.Limit, true
}
// HasLimit returns a boolean if a field has been set.
func (o *SearchRequest) HasLimit() bool {
if o != nil && !IsNil(o.Limit) {
return true
}
return false
}
// SetLimit gets a reference to the given int64 and assigns it to the Limit field.
func (o *SearchRequest) SetLimit(v int64) {
o.Limit = &v
}
// GetMode returns the Mode field value if set, zero value otherwise.
func (o *SearchRequest) GetMode() string {
if o == nil || IsNil(o.Mode) {
var ret string
return ret
}
return *o.Mode
}
// GetModeOk returns a tuple with the Mode field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SearchRequest) GetModeOk() (*string, bool) {
if o == nil || IsNil(o.Mode) {
return nil, false
}
return o.Mode, true
}
// HasMode returns a boolean if a field has been set.
func (o *SearchRequest) HasMode() bool {
if o != nil && !IsNil(o.Mode) {
return true
}
return false
}
// SetMode gets a reference to the given string and assigns it to the Mode field.
func (o *SearchRequest) SetMode(v string) {
o.Mode = &v
}
// GetOffset returns the Offset field value if set, zero value otherwise.
func (o *SearchRequest) GetOffset() int64 {
if o == nil || IsNil(o.Offset) {
var ret int64
return ret
}
return *o.Offset
}
// GetOffsetOk returns a tuple with the Offset field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SearchRequest) GetOffsetOk() (*int64, bool) {
if o == nil || IsNil(o.Offset) {
return nil, false
}
return o.Offset, true
}
// HasOffset returns a boolean if a field has been set.
func (o *SearchRequest) HasOffset() bool {
if o != nil && !IsNil(o.Offset) {
return true
}
return false
}
// SetOffset gets a reference to the given int64 and assigns it to the Offset field.
func (o *SearchRequest) SetOffset(v int64) {
o.Offset = &v
}
// GetProject returns the Project field value if set, zero value otherwise.
func (o *SearchRequest) GetProject() string {
if o == nil || IsNil(o.Project) {
var ret string
return ret
}
return *o.Project
}
// GetProjectOk returns a tuple with the Project field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SearchRequest) GetProjectOk() (*string, bool) {
if o == nil || IsNil(o.Project) {
return nil, false
}
return o.Project, true
}
// HasProject returns a boolean if a field has been set.
func (o *SearchRequest) HasProject() bool {
if o != nil && !IsNil(o.Project) {
return true
}
return false
}
// SetProject gets a reference to the given string and assigns it to the Project field.
func (o *SearchRequest) SetProject(v string) {
o.Project = &v
}
// GetQuery returns the Query field value if set, zero value otherwise.
func (o *SearchRequest) GetQuery() string {
if o == nil || IsNil(o.Query) {
var ret string
return ret
}
return *o.Query
}
// GetQueryOk returns a tuple with the Query field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SearchRequest) GetQueryOk() (*string, bool) {
if o == nil || IsNil(o.Query) {
return nil, false
}
return o.Query, true
}
// HasQuery returns a boolean if a field has been set.
func (o *SearchRequest) HasQuery() bool {
if o != nil && !IsNil(o.Query) {
return true
}
return false
}
// SetQuery gets a reference to the given string and assigns it to the Query field.
func (o *SearchRequest) SetQuery(v string) {
o.Query = &v
}
func (o SearchRequest) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o SearchRequest) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Doctypes) {
toSerialize["doctypes"] = o.Doctypes
}
if !IsNil(o.Index) {
toSerialize["index"] = o.Index
}
if !IsNil(o.Limit) {
toSerialize["limit"] = o.Limit
}
if !IsNil(o.Mode) {
toSerialize["mode"] = o.Mode
}
if !IsNil(o.Offset) {
toSerialize["offset"] = o.Offset
}
if !IsNil(o.Project) {
toSerialize["project"] = o.Project
}
if !IsNil(o.Query) {
toSerialize["query"] = o.Query
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *SearchRequest) UnmarshalJSON(data []byte) (err error) {
varSearchRequest := _SearchRequest{}
err = json.Unmarshal(data, &varSearchRequest)
if err != nil {
return err
}
*o = SearchRequest(varSearchRequest)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "doctypes")
delete(additionalProperties, "index")
delete(additionalProperties, "limit")
delete(additionalProperties, "mode")
delete(additionalProperties, "offset")
delete(additionalProperties, "project")
delete(additionalProperties, "query")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableSearchRequest struct {
value *SearchRequest
isSet bool
}
func (v NullableSearchRequest) Get() *SearchRequest {
return v.value
}
func (v *NullableSearchRequest) Set(val *SearchRequest) {
v.value = val
v.isSet = true
}
func (v NullableSearchRequest) IsSet() bool {
return v.isSet
}
func (v *NullableSearchRequest) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableSearchRequest(val *SearchRequest) *NullableSearchRequest {
return &NullableSearchRequest{value: val, isSet: true}
}
func (v NullableSearchRequest) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableSearchRequest) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}