Files
sdk/model_ai_decisions_answer.go

500 lines
14 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"
"fmt"
)
// checks if the AiDecisionsAnswer type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AiDecisionsAnswer{}
// AiDecisionsAnswer struct for AiDecisionsAnswer
type AiDecisionsAnswer struct {
Action *AiDecisionsAction `json:"action,omitempty"`
AnswerConfidence *float32 `json:"answer_confidence,omitempty"`
Choice *string `json:"choice,omitempty"`
Confidence *float32 `json:"confidence,omitempty"`
Legend map[string]interface{} `json:"legend,omitempty"`
Noul *float32 `json:"noul,omitempty"`
Probabilities map[string]float32 `json:"probabilities,omitempty"`
Probability *float32 `json:"probability,omitempty"`
Score *float32 `json:"score,omitempty"`
Type string `json:"type"`
AdditionalProperties map[string]interface{}
}
type _AiDecisionsAnswer AiDecisionsAnswer
// NewAiDecisionsAnswer instantiates a new AiDecisionsAnswer 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 NewAiDecisionsAnswer(type_ string) *AiDecisionsAnswer {
this := AiDecisionsAnswer{}
this.Type = type_
return &this
}
// NewAiDecisionsAnswerWithDefaults instantiates a new AiDecisionsAnswer 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 NewAiDecisionsAnswerWithDefaults() *AiDecisionsAnswer {
this := AiDecisionsAnswer{}
return &this
}
// GetAction returns the Action field value if set, zero value otherwise.
func (o *AiDecisionsAnswer) GetAction() AiDecisionsAction {
if o == nil || IsNil(o.Action) {
var ret AiDecisionsAction
return ret
}
return *o.Action
}
// GetActionOk returns a tuple with the Action field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiDecisionsAnswer) GetActionOk() (*AiDecisionsAction, bool) {
if o == nil || IsNil(o.Action) {
return nil, false
}
return o.Action, true
}
// HasAction returns a boolean if a field has been set.
func (o *AiDecisionsAnswer) HasAction() bool {
if o != nil && !IsNil(o.Action) {
return true
}
return false
}
// SetAction gets a reference to the given AiDecisionsAction and assigns it to the Action field.
func (o *AiDecisionsAnswer) SetAction(v AiDecisionsAction) {
o.Action = &v
}
// GetAnswerConfidence returns the AnswerConfidence field value if set, zero value otherwise.
func (o *AiDecisionsAnswer) GetAnswerConfidence() float32 {
if o == nil || IsNil(o.AnswerConfidence) {
var ret float32
return ret
}
return *o.AnswerConfidence
}
// GetAnswerConfidenceOk returns a tuple with the AnswerConfidence field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiDecisionsAnswer) GetAnswerConfidenceOk() (*float32, bool) {
if o == nil || IsNil(o.AnswerConfidence) {
return nil, false
}
return o.AnswerConfidence, true
}
// HasAnswerConfidence returns a boolean if a field has been set.
func (o *AiDecisionsAnswer) HasAnswerConfidence() bool {
if o != nil && !IsNil(o.AnswerConfidence) {
return true
}
return false
}
// SetAnswerConfidence gets a reference to the given float32 and assigns it to the AnswerConfidence field.
func (o *AiDecisionsAnswer) SetAnswerConfidence(v float32) {
o.AnswerConfidence = &v
}
// GetChoice returns the Choice field value if set, zero value otherwise.
func (o *AiDecisionsAnswer) GetChoice() string {
if o == nil || IsNil(o.Choice) {
var ret string
return ret
}
return *o.Choice
}
// GetChoiceOk returns a tuple with the Choice field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiDecisionsAnswer) GetChoiceOk() (*string, bool) {
if o == nil || IsNil(o.Choice) {
return nil, false
}
return o.Choice, true
}
// HasChoice returns a boolean if a field has been set.
func (o *AiDecisionsAnswer) HasChoice() bool {
if o != nil && !IsNil(o.Choice) {
return true
}
return false
}
// SetChoice gets a reference to the given string and assigns it to the Choice field.
func (o *AiDecisionsAnswer) SetChoice(v string) {
o.Choice = &v
}
// GetConfidence returns the Confidence field value if set, zero value otherwise.
func (o *AiDecisionsAnswer) GetConfidence() float32 {
if o == nil || IsNil(o.Confidence) {
var ret float32
return ret
}
return *o.Confidence
}
// GetConfidenceOk returns a tuple with the Confidence field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiDecisionsAnswer) GetConfidenceOk() (*float32, bool) {
if o == nil || IsNil(o.Confidence) {
return nil, false
}
return o.Confidence, true
}
// HasConfidence returns a boolean if a field has been set.
func (o *AiDecisionsAnswer) HasConfidence() bool {
if o != nil && !IsNil(o.Confidence) {
return true
}
return false
}
// SetConfidence gets a reference to the given float32 and assigns it to the Confidence field.
func (o *AiDecisionsAnswer) SetConfidence(v float32) {
o.Confidence = &v
}
// GetLegend returns the Legend field value if set, zero value otherwise.
func (o *AiDecisionsAnswer) GetLegend() map[string]interface{} {
if o == nil || IsNil(o.Legend) {
var ret map[string]interface{}
return ret
}
return o.Legend
}
// GetLegendOk returns a tuple with the Legend field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiDecisionsAnswer) GetLegendOk() (map[string]interface{}, bool) {
if o == nil || IsNil(o.Legend) {
return map[string]interface{}{}, false
}
return o.Legend, true
}
// HasLegend returns a boolean if a field has been set.
func (o *AiDecisionsAnswer) HasLegend() bool {
if o != nil && !IsNil(o.Legend) {
return true
}
return false
}
// SetLegend gets a reference to the given map[string]interface{} and assigns it to the Legend field.
func (o *AiDecisionsAnswer) SetLegend(v map[string]interface{}) {
o.Legend = v
}
// GetNoul returns the Noul field value if set, zero value otherwise.
func (o *AiDecisionsAnswer) GetNoul() float32 {
if o == nil || IsNil(o.Noul) {
var ret float32
return ret
}
return *o.Noul
}
// GetNoulOk returns a tuple with the Noul field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiDecisionsAnswer) GetNoulOk() (*float32, bool) {
if o == nil || IsNil(o.Noul) {
return nil, false
}
return o.Noul, true
}
// HasNoul returns a boolean if a field has been set.
func (o *AiDecisionsAnswer) HasNoul() bool {
if o != nil && !IsNil(o.Noul) {
return true
}
return false
}
// SetNoul gets a reference to the given float32 and assigns it to the Noul field.
func (o *AiDecisionsAnswer) SetNoul(v float32) {
o.Noul = &v
}
// GetProbabilities returns the Probabilities field value if set, zero value otherwise.
func (o *AiDecisionsAnswer) GetProbabilities() map[string]float32 {
if o == nil || IsNil(o.Probabilities) {
var ret map[string]float32
return ret
}
return o.Probabilities
}
// GetProbabilitiesOk returns a tuple with the Probabilities field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiDecisionsAnswer) GetProbabilitiesOk() (map[string]float32, bool) {
if o == nil || IsNil(o.Probabilities) {
return map[string]float32{}, false
}
return o.Probabilities, true
}
// HasProbabilities returns a boolean if a field has been set.
func (o *AiDecisionsAnswer) HasProbabilities() bool {
if o != nil && !IsNil(o.Probabilities) {
return true
}
return false
}
// SetProbabilities gets a reference to the given map[string]float32 and assigns it to the Probabilities field.
func (o *AiDecisionsAnswer) SetProbabilities(v map[string]float32) {
o.Probabilities = v
}
// GetProbability returns the Probability field value if set, zero value otherwise.
func (o *AiDecisionsAnswer) GetProbability() float32 {
if o == nil || IsNil(o.Probability) {
var ret float32
return ret
}
return *o.Probability
}
// GetProbabilityOk returns a tuple with the Probability field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiDecisionsAnswer) GetProbabilityOk() (*float32, bool) {
if o == nil || IsNil(o.Probability) {
return nil, false
}
return o.Probability, true
}
// HasProbability returns a boolean if a field has been set.
func (o *AiDecisionsAnswer) HasProbability() bool {
if o != nil && !IsNil(o.Probability) {
return true
}
return false
}
// SetProbability gets a reference to the given float32 and assigns it to the Probability field.
func (o *AiDecisionsAnswer) SetProbability(v float32) {
o.Probability = &v
}
// GetScore returns the Score field value if set, zero value otherwise.
func (o *AiDecisionsAnswer) GetScore() float32 {
if o == nil || IsNil(o.Score) {
var ret float32
return ret
}
return *o.Score
}
// GetScoreOk returns a tuple with the Score field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiDecisionsAnswer) GetScoreOk() (*float32, bool) {
if o == nil || IsNil(o.Score) {
return nil, false
}
return o.Score, true
}
// HasScore returns a boolean if a field has been set.
func (o *AiDecisionsAnswer) HasScore() bool {
if o != nil && !IsNil(o.Score) {
return true
}
return false
}
// SetScore gets a reference to the given float32 and assigns it to the Score field.
func (o *AiDecisionsAnswer) SetScore(v float32) {
o.Score = &v
}
// GetType returns the Type field value
func (o *AiDecisionsAnswer) GetType() string {
if o == nil {
var ret string
return ret
}
return o.Type
}
// GetTypeOk returns a tuple with the Type field value
// and a boolean to check if the value has been set.
func (o *AiDecisionsAnswer) GetTypeOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Type, true
}
// SetType sets field value
func (o *AiDecisionsAnswer) SetType(v string) {
o.Type = v
}
func (o AiDecisionsAnswer) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o AiDecisionsAnswer) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Action) {
toSerialize["action"] = o.Action
}
if !IsNil(o.AnswerConfidence) {
toSerialize["answer_confidence"] = o.AnswerConfidence
}
if !IsNil(o.Choice) {
toSerialize["choice"] = o.Choice
}
if !IsNil(o.Confidence) {
toSerialize["confidence"] = o.Confidence
}
if !IsNil(o.Legend) {
toSerialize["legend"] = o.Legend
}
if !IsNil(o.Noul) {
toSerialize["noul"] = o.Noul
}
if !IsNil(o.Probabilities) {
toSerialize["probabilities"] = o.Probabilities
}
if !IsNil(o.Probability) {
toSerialize["probability"] = o.Probability
}
if !IsNil(o.Score) {
toSerialize["score"] = o.Score
}
toSerialize["type"] = o.Type
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *AiDecisionsAnswer) 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{
"type",
}
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)
}
}
varAiDecisionsAnswer := _AiDecisionsAnswer{}
err = json.Unmarshal(data, &varAiDecisionsAnswer)
if err != nil {
return err
}
*o = AiDecisionsAnswer(varAiDecisionsAnswer)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "action")
delete(additionalProperties, "answer_confidence")
delete(additionalProperties, "choice")
delete(additionalProperties, "confidence")
delete(additionalProperties, "legend")
delete(additionalProperties, "noul")
delete(additionalProperties, "probabilities")
delete(additionalProperties, "probability")
delete(additionalProperties, "score")
delete(additionalProperties, "type")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableAiDecisionsAnswer struct {
value *AiDecisionsAnswer
isSet bool
}
func (v NullableAiDecisionsAnswer) Get() *AiDecisionsAnswer {
return v.value
}
func (v *NullableAiDecisionsAnswer) Set(val *AiDecisionsAnswer) {
v.value = val
v.isSet = true
}
func (v NullableAiDecisionsAnswer) IsSet() bool {
return v.isSet
}
func (v *NullableAiDecisionsAnswer) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAiDecisionsAnswer(val *AiDecisionsAnswer) *NullableAiDecisionsAnswer {
return &NullableAiDecisionsAnswer{value: val, isSet: true}
}
func (v NullableAiDecisionsAnswer) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAiDecisionsAnswer) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}