mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
269 lines
7.4 KiB
Go
269 lines
7.4 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 CodeAskAnswer type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &CodeAskAnswer{}
|
|
|
|
// CodeAskAnswer struct for CodeAskAnswer
|
|
type CodeAskAnswer struct {
|
|
// Answer is the synthesized prose. EMPTY is a real answer here: nothing in the index matched, or synthesis was unavailable — read `degraded` and `citations` to tell those apart. It is never written without grounding.
|
|
Answer *string `json:"answer,omitempty"`
|
|
// Citations are the exact regions the answer was grounded on, and they are the point: an answer is checkable only because every claim in it can be read back at a file and line. Present even when Answer is empty.
|
|
Citations []CodeCitation `json:"citations,omitempty"`
|
|
// Degraded is true when retrieval worked but no synthesizer was reachable. The citations are still real code, so a caller can answer from them itself; a caller that treats this like an error throws away a usable result.
|
|
Degraded *bool `json:"degraded,omitempty"`
|
|
// Question is the ask, echoed back.
|
|
Question *string `json:"question,omitempty"`
|
|
AdditionalProperties map[string]interface{}
|
|
}
|
|
|
|
type _CodeAskAnswer CodeAskAnswer
|
|
|
|
// NewCodeAskAnswer instantiates a new CodeAskAnswer 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 NewCodeAskAnswer() *CodeAskAnswer {
|
|
this := CodeAskAnswer{}
|
|
return &this
|
|
}
|
|
|
|
// NewCodeAskAnswerWithDefaults instantiates a new CodeAskAnswer 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 NewCodeAskAnswerWithDefaults() *CodeAskAnswer {
|
|
this := CodeAskAnswer{}
|
|
return &this
|
|
}
|
|
|
|
// GetAnswer returns the Answer field value if set, zero value otherwise.
|
|
func (o *CodeAskAnswer) GetAnswer() string {
|
|
if o == nil || IsNil(o.Answer) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Answer
|
|
}
|
|
|
|
// GetAnswerOk returns a tuple with the Answer field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *CodeAskAnswer) GetAnswerOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Answer) {
|
|
return nil, false
|
|
}
|
|
return o.Answer, true
|
|
}
|
|
|
|
// HasAnswer returns a boolean if a field has been set.
|
|
func (o *CodeAskAnswer) HasAnswer() bool {
|
|
if o != nil && !IsNil(o.Answer) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetAnswer gets a reference to the given string and assigns it to the Answer field.
|
|
func (o *CodeAskAnswer) SetAnswer(v string) {
|
|
o.Answer = &v
|
|
}
|
|
|
|
// GetCitations returns the Citations field value if set, zero value otherwise.
|
|
func (o *CodeAskAnswer) GetCitations() []CodeCitation {
|
|
if o == nil || IsNil(o.Citations) {
|
|
var ret []CodeCitation
|
|
return ret
|
|
}
|
|
return o.Citations
|
|
}
|
|
|
|
// GetCitationsOk returns a tuple with the Citations field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *CodeAskAnswer) GetCitationsOk() ([]CodeCitation, bool) {
|
|
if o == nil || IsNil(o.Citations) {
|
|
return nil, false
|
|
}
|
|
return o.Citations, true
|
|
}
|
|
|
|
// HasCitations returns a boolean if a field has been set.
|
|
func (o *CodeAskAnswer) HasCitations() bool {
|
|
if o != nil && !IsNil(o.Citations) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetCitations gets a reference to the given []CodeCitation and assigns it to the Citations field.
|
|
func (o *CodeAskAnswer) SetCitations(v []CodeCitation) {
|
|
o.Citations = v
|
|
}
|
|
|
|
// GetDegraded returns the Degraded field value if set, zero value otherwise.
|
|
func (o *CodeAskAnswer) 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 *CodeAskAnswer) 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 *CodeAskAnswer) 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 *CodeAskAnswer) SetDegraded(v bool) {
|
|
o.Degraded = &v
|
|
}
|
|
|
|
// GetQuestion returns the Question field value if set, zero value otherwise.
|
|
func (o *CodeAskAnswer) GetQuestion() string {
|
|
if o == nil || IsNil(o.Question) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Question
|
|
}
|
|
|
|
// GetQuestionOk returns a tuple with the Question field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *CodeAskAnswer) GetQuestionOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Question) {
|
|
return nil, false
|
|
}
|
|
return o.Question, true
|
|
}
|
|
|
|
// HasQuestion returns a boolean if a field has been set.
|
|
func (o *CodeAskAnswer) HasQuestion() bool {
|
|
if o != nil && !IsNil(o.Question) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetQuestion gets a reference to the given string and assigns it to the Question field.
|
|
func (o *CodeAskAnswer) SetQuestion(v string) {
|
|
o.Question = &v
|
|
}
|
|
|
|
func (o CodeAskAnswer) MarshalJSON() ([]byte, error) {
|
|
toSerialize, err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o CodeAskAnswer) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if !IsNil(o.Answer) {
|
|
toSerialize["answer"] = o.Answer
|
|
}
|
|
if !IsNil(o.Citations) {
|
|
toSerialize["citations"] = o.Citations
|
|
}
|
|
if !IsNil(o.Degraded) {
|
|
toSerialize["degraded"] = o.Degraded
|
|
}
|
|
if !IsNil(o.Question) {
|
|
toSerialize["question"] = o.Question
|
|
}
|
|
|
|
for key, value := range o.AdditionalProperties {
|
|
toSerialize[key] = value
|
|
}
|
|
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *CodeAskAnswer) UnmarshalJSON(data []byte) (err error) {
|
|
varCodeAskAnswer := _CodeAskAnswer{}
|
|
|
|
err = json.Unmarshal(data, &varCodeAskAnswer)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = CodeAskAnswer(varCodeAskAnswer)
|
|
|
|
additionalProperties := make(map[string]interface{})
|
|
|
|
if err = json.Unmarshal(data, &additionalProperties); err == nil {
|
|
delete(additionalProperties, "answer")
|
|
delete(additionalProperties, "citations")
|
|
delete(additionalProperties, "degraded")
|
|
delete(additionalProperties, "question")
|
|
o.AdditionalProperties = additionalProperties
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
type NullableCodeAskAnswer struct {
|
|
value *CodeAskAnswer
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableCodeAskAnswer) Get() *CodeAskAnswer {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableCodeAskAnswer) Set(val *CodeAskAnswer) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableCodeAskAnswer) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableCodeAskAnswer) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableCodeAskAnswer(val *CodeAskAnswer) *NullableCodeAskAnswer {
|
|
return &NullableCodeAskAnswer{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableCodeAskAnswer) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableCodeAskAnswer) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|