Files
sdk/model_ai_decisions_choice.go

238 lines
6.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"
"fmt"
)
// checks if the AiDecisionsChoice type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AiDecisionsChoice{}
// AiDecisionsChoice struct for AiDecisionsChoice
type AiDecisionsChoice struct {
Criteria interface{} `json:"criteria"`
Instructions interface{} `json:"instructions,omitempty"`
Type string `json:"type"`
AdditionalProperties map[string]interface{}
}
type _AiDecisionsChoice AiDecisionsChoice
// NewAiDecisionsChoice instantiates a new AiDecisionsChoice 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 NewAiDecisionsChoice(criteria interface{}, type_ string) *AiDecisionsChoice {
this := AiDecisionsChoice{}
this.Criteria = criteria
this.Type = type_
return &this
}
// NewAiDecisionsChoiceWithDefaults instantiates a new AiDecisionsChoice 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 NewAiDecisionsChoiceWithDefaults() *AiDecisionsChoice {
this := AiDecisionsChoice{}
return &this
}
// GetCriteria returns the Criteria field value
// If the value is explicit nil, the zero value for interface{} will be returned
func (o *AiDecisionsChoice) GetCriteria() interface{} {
if o == nil {
var ret interface{}
return ret
}
return o.Criteria
}
// GetCriteriaOk returns a tuple with the Criteria field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *AiDecisionsChoice) GetCriteriaOk() (*interface{}, bool) {
if o == nil || IsNil(o.Criteria) {
return nil, false
}
return &o.Criteria, true
}
// SetCriteria sets field value
func (o *AiDecisionsChoice) SetCriteria(v interface{}) {
o.Criteria = v
}
// GetInstructions returns the Instructions field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *AiDecisionsChoice) GetInstructions() interface{} {
if o == nil {
var ret interface{}
return ret
}
return o.Instructions
}
// GetInstructionsOk returns a tuple with the Instructions field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *AiDecisionsChoice) GetInstructionsOk() (*interface{}, bool) {
if o == nil || IsNil(o.Instructions) {
return nil, false
}
return &o.Instructions, true
}
// HasInstructions returns a boolean if a field has been set.
func (o *AiDecisionsChoice) HasInstructions() bool {
if o != nil && !IsNil(o.Instructions) {
return true
}
return false
}
// SetInstructions gets a reference to the given interface{} and assigns it to the Instructions field.
func (o *AiDecisionsChoice) SetInstructions(v interface{}) {
o.Instructions = v
}
// GetType returns the Type field value
func (o *AiDecisionsChoice) 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 *AiDecisionsChoice) GetTypeOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Type, true
}
// SetType sets field value
func (o *AiDecisionsChoice) SetType(v string) {
o.Type = v
}
func (o AiDecisionsChoice) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o AiDecisionsChoice) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if o.Criteria != nil {
toSerialize["criteria"] = o.Criteria
}
if o.Instructions != nil {
toSerialize["instructions"] = o.Instructions
}
toSerialize["type"] = o.Type
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *AiDecisionsChoice) 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{
"criteria",
"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)
}
}
varAiDecisionsChoice := _AiDecisionsChoice{}
err = json.Unmarshal(data, &varAiDecisionsChoice)
if err != nil {
return err
}
*o = AiDecisionsChoice(varAiDecisionsChoice)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "criteria")
delete(additionalProperties, "instructions")
delete(additionalProperties, "type")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableAiDecisionsChoice struct {
value *AiDecisionsChoice
isSet bool
}
func (v NullableAiDecisionsChoice) Get() *AiDecisionsChoice {
return v.value
}
func (v *NullableAiDecisionsChoice) Set(val *AiDecisionsChoice) {
v.value = val
v.isSet = true
}
func (v NullableAiDecisionsChoice) IsSet() bool {
return v.isSet
}
func (v *NullableAiDecisionsChoice) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAiDecisionsChoice(val *AiDecisionsChoice) *NullableAiDecisionsChoice {
return &NullableAiDecisionsChoice{value: val, isSet: true}
}
func (v NullableAiDecisionsChoice) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAiDecisionsChoice) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}