Files
sdk/model_code_search_results.go

307 lines
8.3 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 CodeSearchResults type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &CodeSearchResults{}
// CodeSearchResults struct for CodeSearchResults
type CodeSearchResults struct {
// Capped is true when the semantic tier stopped at its scan cap — it compares a query with at most 50000 stored vectors — with more left unread, so a chunk past the cap could not be found by meaning. The text, regex and symbol tiers read the whole index either way. Absent otherwise.
Capped *bool `json:"capped,omitempty"`
// Degraded is true when retrieval failed and the empty result set is an outage rather than a real absence of matches. Absent on a healthy answer.
Degraded *bool `json:"degraded,omitempty"`
// Query echoes the query that was run.
Query *string `json:"query,omitempty"`
// Results are the matching spans, best first. Never null — an empty search is an empty array.
Results []CodeSpan `json:"results,omitempty"`
// Type echoes the retrieval tier that ran, after defaulting.
Type *string `json:"type,omitempty"`
AdditionalProperties map[string]interface{}
}
type _CodeSearchResults CodeSearchResults
// NewCodeSearchResults instantiates a new CodeSearchResults 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 NewCodeSearchResults() *CodeSearchResults {
this := CodeSearchResults{}
return &this
}
// NewCodeSearchResultsWithDefaults instantiates a new CodeSearchResults 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 NewCodeSearchResultsWithDefaults() *CodeSearchResults {
this := CodeSearchResults{}
return &this
}
// GetCapped returns the Capped field value if set, zero value otherwise.
func (o *CodeSearchResults) GetCapped() bool {
if o == nil || IsNil(o.Capped) {
var ret bool
return ret
}
return *o.Capped
}
// GetCappedOk returns a tuple with the Capped field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CodeSearchResults) GetCappedOk() (*bool, bool) {
if o == nil || IsNil(o.Capped) {
return nil, false
}
return o.Capped, true
}
// HasCapped returns a boolean if a field has been set.
func (o *CodeSearchResults) HasCapped() bool {
if o != nil && !IsNil(o.Capped) {
return true
}
return false
}
// SetCapped gets a reference to the given bool and assigns it to the Capped field.
func (o *CodeSearchResults) SetCapped(v bool) {
o.Capped = &v
}
// GetDegraded returns the Degraded field value if set, zero value otherwise.
func (o *CodeSearchResults) GetDegraded() bool {
if o == nil || IsNil(o.Degraded) {
var ret bool
return ret
}
return *o.Degraded
}
// GetDegradedOk returns a tuple with the Degraded field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CodeSearchResults) GetDegradedOk() (*bool, bool) {
if o == nil || IsNil(o.Degraded) {
return nil, false
}
return o.Degraded, true
}
// HasDegraded returns a boolean if a field has been set.
func (o *CodeSearchResults) HasDegraded() bool {
if o != nil && !IsNil(o.Degraded) {
return true
}
return false
}
// SetDegraded gets a reference to the given bool and assigns it to the Degraded field.
func (o *CodeSearchResults) SetDegraded(v bool) {
o.Degraded = &v
}
// GetQuery returns the Query field value if set, zero value otherwise.
func (o *CodeSearchResults) 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 *CodeSearchResults) 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 *CodeSearchResults) 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 *CodeSearchResults) SetQuery(v string) {
o.Query = &v
}
// GetResults returns the Results field value if set, zero value otherwise.
func (o *CodeSearchResults) GetResults() []CodeSpan {
if o == nil || IsNil(o.Results) {
var ret []CodeSpan
return ret
}
return o.Results
}
// GetResultsOk returns a tuple with the Results field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CodeSearchResults) GetResultsOk() ([]CodeSpan, bool) {
if o == nil || IsNil(o.Results) {
return nil, false
}
return o.Results, true
}
// HasResults returns a boolean if a field has been set.
func (o *CodeSearchResults) HasResults() bool {
if o != nil && !IsNil(o.Results) {
return true
}
return false
}
// SetResults gets a reference to the given []CodeSpan and assigns it to the Results field.
func (o *CodeSearchResults) SetResults(v []CodeSpan) {
o.Results = v
}
// GetType returns the Type field value if set, zero value otherwise.
func (o *CodeSearchResults) GetType() string {
if o == nil || IsNil(o.Type) {
var ret string
return ret
}
return *o.Type
}
// GetTypeOk returns a tuple with the Type field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CodeSearchResults) GetTypeOk() (*string, bool) {
if o == nil || IsNil(o.Type) {
return nil, false
}
return o.Type, true
}
// HasType returns a boolean if a field has been set.
func (o *CodeSearchResults) HasType() bool {
if o != nil && !IsNil(o.Type) {
return true
}
return false
}
// SetType gets a reference to the given string and assigns it to the Type field.
func (o *CodeSearchResults) SetType(v string) {
o.Type = &v
}
func (o CodeSearchResults) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o CodeSearchResults) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Capped) {
toSerialize["capped"] = o.Capped
}
if !IsNil(o.Degraded) {
toSerialize["degraded"] = o.Degraded
}
if !IsNil(o.Query) {
toSerialize["query"] = o.Query
}
if !IsNil(o.Results) {
toSerialize["results"] = o.Results
}
if !IsNil(o.Type) {
toSerialize["type"] = o.Type
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *CodeSearchResults) UnmarshalJSON(data []byte) (err error) {
varCodeSearchResults := _CodeSearchResults{}
err = json.Unmarshal(data, &varCodeSearchResults)
if err != nil {
return err
}
*o = CodeSearchResults(varCodeSearchResults)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "capped")
delete(additionalProperties, "degraded")
delete(additionalProperties, "query")
delete(additionalProperties, "results")
delete(additionalProperties, "type")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableCodeSearchResults struct {
value *CodeSearchResults
isSet bool
}
func (v NullableCodeSearchResults) Get() *CodeSearchResults {
return v.value
}
func (v *NullableCodeSearchResults) Set(val *CodeSearchResults) {
v.value = val
v.isSet = true
}
func (v NullableCodeSearchResults) IsSet() bool {
return v.isSet
}
func (v *NullableCodeSearchResults) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCodeSearchResults(val *CodeSearchResults) *NullableCodeSearchResults {
return &NullableCodeSearchResults{value: val, isSet: true}
}
func (v NullableCodeSearchResults) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCodeSearchResults) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}