Files
sdk/model_search_fusion.go

307 lines
8.1 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 SearchFusion type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &SearchFusion{}
// SearchFusion struct for SearchFusion
type SearchFusion struct {
// Backends is the per-leg report. Always populated.
Backends []SearchBackendStatus `json:"backends,omitempty"`
// Hits is the fused, ranked result set.
Hits []SearchHit `json:"hits,omitempty"`
// Mode is the mode actually used after `auto` resolution.
Mode *string `json:"mode,omitempty"`
// Status is the query's overall honesty signal: ok every consulted leg answered. partial at least one leg failed; Hits holds the survivors' results. unavailable every consulted leg failed; Hits is empty AND that is stated.
Status *string `json:"status,omitempty"`
// TookMS is the whole query's wall time in milliseconds — every leg it consulted, plus fusion and paging. Each leg's own share is in Backends[].TookMS; the legs run in sequence, so this is at least their sum.
TookMs *int64 `json:"took_ms,omitempty"`
AdditionalProperties map[string]interface{}
}
type _SearchFusion SearchFusion
// NewSearchFusion instantiates a new SearchFusion 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 NewSearchFusion() *SearchFusion {
this := SearchFusion{}
return &this
}
// NewSearchFusionWithDefaults instantiates a new SearchFusion 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 NewSearchFusionWithDefaults() *SearchFusion {
this := SearchFusion{}
return &this
}
// GetBackends returns the Backends field value if set, zero value otherwise.
func (o *SearchFusion) GetBackends() []SearchBackendStatus {
if o == nil || IsNil(o.Backends) {
var ret []SearchBackendStatus
return ret
}
return o.Backends
}
// GetBackendsOk returns a tuple with the Backends field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SearchFusion) GetBackendsOk() ([]SearchBackendStatus, bool) {
if o == nil || IsNil(o.Backends) {
return nil, false
}
return o.Backends, true
}
// HasBackends returns a boolean if a field has been set.
func (o *SearchFusion) HasBackends() bool {
if o != nil && !IsNil(o.Backends) {
return true
}
return false
}
// SetBackends gets a reference to the given []SearchBackendStatus and assigns it to the Backends field.
func (o *SearchFusion) SetBackends(v []SearchBackendStatus) {
o.Backends = v
}
// GetHits returns the Hits field value if set, zero value otherwise.
func (o *SearchFusion) GetHits() []SearchHit {
if o == nil || IsNil(o.Hits) {
var ret []SearchHit
return ret
}
return o.Hits
}
// GetHitsOk returns a tuple with the Hits field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SearchFusion) GetHitsOk() ([]SearchHit, bool) {
if o == nil || IsNil(o.Hits) {
return nil, false
}
return o.Hits, true
}
// HasHits returns a boolean if a field has been set.
func (o *SearchFusion) HasHits() bool {
if o != nil && !IsNil(o.Hits) {
return true
}
return false
}
// SetHits gets a reference to the given []SearchHit and assigns it to the Hits field.
func (o *SearchFusion) SetHits(v []SearchHit) {
o.Hits = v
}
// GetMode returns the Mode field value if set, zero value otherwise.
func (o *SearchFusion) 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 *SearchFusion) 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 *SearchFusion) 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 *SearchFusion) SetMode(v string) {
o.Mode = &v
}
// GetStatus returns the Status field value if set, zero value otherwise.
func (o *SearchFusion) GetStatus() string {
if o == nil || IsNil(o.Status) {
var ret string
return ret
}
return *o.Status
}
// GetStatusOk returns a tuple with the Status field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SearchFusion) GetStatusOk() (*string, bool) {
if o == nil || IsNil(o.Status) {
return nil, false
}
return o.Status, true
}
// HasStatus returns a boolean if a field has been set.
func (o *SearchFusion) HasStatus() bool {
if o != nil && !IsNil(o.Status) {
return true
}
return false
}
// SetStatus gets a reference to the given string and assigns it to the Status field.
func (o *SearchFusion) SetStatus(v string) {
o.Status = &v
}
// GetTookMs returns the TookMs field value if set, zero value otherwise.
func (o *SearchFusion) GetTookMs() int64 {
if o == nil || IsNil(o.TookMs) {
var ret int64
return ret
}
return *o.TookMs
}
// GetTookMsOk returns a tuple with the TookMs field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SearchFusion) GetTookMsOk() (*int64, bool) {
if o == nil || IsNil(o.TookMs) {
return nil, false
}
return o.TookMs, true
}
// HasTookMs returns a boolean if a field has been set.
func (o *SearchFusion) HasTookMs() bool {
if o != nil && !IsNil(o.TookMs) {
return true
}
return false
}
// SetTookMs gets a reference to the given int64 and assigns it to the TookMs field.
func (o *SearchFusion) SetTookMs(v int64) {
o.TookMs = &v
}
func (o SearchFusion) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o SearchFusion) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Backends) {
toSerialize["backends"] = o.Backends
}
if !IsNil(o.Hits) {
toSerialize["hits"] = o.Hits
}
if !IsNil(o.Mode) {
toSerialize["mode"] = o.Mode
}
if !IsNil(o.Status) {
toSerialize["status"] = o.Status
}
if !IsNil(o.TookMs) {
toSerialize["took_ms"] = o.TookMs
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *SearchFusion) UnmarshalJSON(data []byte) (err error) {
varSearchFusion := _SearchFusion{}
err = json.Unmarshal(data, &varSearchFusion)
if err != nil {
return err
}
*o = SearchFusion(varSearchFusion)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "backends")
delete(additionalProperties, "hits")
delete(additionalProperties, "mode")
delete(additionalProperties, "status")
delete(additionalProperties, "took_ms")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableSearchFusion struct {
value *SearchFusion
isSet bool
}
func (v NullableSearchFusion) Get() *SearchFusion {
return v.value
}
func (v *NullableSearchFusion) Set(val *SearchFusion) {
v.value = val
v.isSet = true
}
func (v NullableSearchFusion) IsSet() bool {
return v.isSet
}
func (v *NullableSearchFusion) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableSearchFusion(val *SearchFusion) *NullableSearchFusion {
return &NullableSearchFusion{value: val, isSet: true}
}
func (v NullableSearchFusion) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableSearchFusion) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}