mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
245 lines
6.3 KiB
Go
245 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"
|
|
"gopkg.in/validator.v2"
|
|
)
|
|
|
|
// AiDecisionsQuestion - struct for AiDecisionsQuestion
|
|
type AiDecisionsQuestion struct {
|
|
AiDecisionsBoolean *AiDecisionsBoolean
|
|
AiDecisionsChoice *AiDecisionsChoice
|
|
AiDecisionsNoul *AiDecisionsNoul
|
|
AiDecisionsScore *AiDecisionsScore
|
|
}
|
|
|
|
// AiDecisionsBooleanAsAiDecisionsQuestion is a convenience function that returns AiDecisionsBoolean wrapped in AiDecisionsQuestion
|
|
func AiDecisionsBooleanAsAiDecisionsQuestion(v *AiDecisionsBoolean) AiDecisionsQuestion {
|
|
return AiDecisionsQuestion{
|
|
AiDecisionsBoolean: v,
|
|
}
|
|
}
|
|
|
|
// AiDecisionsChoiceAsAiDecisionsQuestion is a convenience function that returns AiDecisionsChoice wrapped in AiDecisionsQuestion
|
|
func AiDecisionsChoiceAsAiDecisionsQuestion(v *AiDecisionsChoice) AiDecisionsQuestion {
|
|
return AiDecisionsQuestion{
|
|
AiDecisionsChoice: v,
|
|
}
|
|
}
|
|
|
|
// AiDecisionsNoulAsAiDecisionsQuestion is a convenience function that returns AiDecisionsNoul wrapped in AiDecisionsQuestion
|
|
func AiDecisionsNoulAsAiDecisionsQuestion(v *AiDecisionsNoul) AiDecisionsQuestion {
|
|
return AiDecisionsQuestion{
|
|
AiDecisionsNoul: v,
|
|
}
|
|
}
|
|
|
|
// AiDecisionsScoreAsAiDecisionsQuestion is a convenience function that returns AiDecisionsScore wrapped in AiDecisionsQuestion
|
|
func AiDecisionsScoreAsAiDecisionsQuestion(v *AiDecisionsScore) AiDecisionsQuestion {
|
|
return AiDecisionsQuestion{
|
|
AiDecisionsScore: v,
|
|
}
|
|
}
|
|
|
|
// Unmarshal JSON data into one of the pointers in the struct
|
|
func (dst *AiDecisionsQuestion) UnmarshalJSON(data []byte) error {
|
|
var err error
|
|
match := 0
|
|
// try to unmarshal data into AiDecisionsBoolean
|
|
err = newStrictDecoder(data).Decode(&dst.AiDecisionsBoolean)
|
|
if err == nil {
|
|
jsonAiDecisionsBoolean, _ := json.Marshal(dst.AiDecisionsBoolean)
|
|
if string(jsonAiDecisionsBoolean) == "{}" { // empty struct
|
|
dst.AiDecisionsBoolean = nil
|
|
} else {
|
|
if err = validator.Validate(dst.AiDecisionsBoolean); err != nil {
|
|
dst.AiDecisionsBoolean = nil
|
|
} else {
|
|
match++
|
|
}
|
|
}
|
|
} else {
|
|
dst.AiDecisionsBoolean = nil
|
|
}
|
|
|
|
// try to unmarshal data into AiDecisionsChoice
|
|
err = newStrictDecoder(data).Decode(&dst.AiDecisionsChoice)
|
|
if err == nil {
|
|
jsonAiDecisionsChoice, _ := json.Marshal(dst.AiDecisionsChoice)
|
|
if string(jsonAiDecisionsChoice) == "{}" { // empty struct
|
|
dst.AiDecisionsChoice = nil
|
|
} else {
|
|
if err = validator.Validate(dst.AiDecisionsChoice); err != nil {
|
|
dst.AiDecisionsChoice = nil
|
|
} else {
|
|
match++
|
|
}
|
|
}
|
|
} else {
|
|
dst.AiDecisionsChoice = nil
|
|
}
|
|
|
|
// try to unmarshal data into AiDecisionsNoul
|
|
err = newStrictDecoder(data).Decode(&dst.AiDecisionsNoul)
|
|
if err == nil {
|
|
jsonAiDecisionsNoul, _ := json.Marshal(dst.AiDecisionsNoul)
|
|
if string(jsonAiDecisionsNoul) == "{}" { // empty struct
|
|
dst.AiDecisionsNoul = nil
|
|
} else {
|
|
if err = validator.Validate(dst.AiDecisionsNoul); err != nil {
|
|
dst.AiDecisionsNoul = nil
|
|
} else {
|
|
match++
|
|
}
|
|
}
|
|
} else {
|
|
dst.AiDecisionsNoul = nil
|
|
}
|
|
|
|
// try to unmarshal data into AiDecisionsScore
|
|
err = newStrictDecoder(data).Decode(&dst.AiDecisionsScore)
|
|
if err == nil {
|
|
jsonAiDecisionsScore, _ := json.Marshal(dst.AiDecisionsScore)
|
|
if string(jsonAiDecisionsScore) == "{}" { // empty struct
|
|
dst.AiDecisionsScore = nil
|
|
} else {
|
|
if err = validator.Validate(dst.AiDecisionsScore); err != nil {
|
|
dst.AiDecisionsScore = nil
|
|
} else {
|
|
match++
|
|
}
|
|
}
|
|
} else {
|
|
dst.AiDecisionsScore = nil
|
|
}
|
|
|
|
if match > 1 { // more than 1 match
|
|
// reset to nil
|
|
dst.AiDecisionsBoolean = nil
|
|
dst.AiDecisionsChoice = nil
|
|
dst.AiDecisionsNoul = nil
|
|
dst.AiDecisionsScore = nil
|
|
|
|
return fmt.Errorf("data matches more than one schema in oneOf(AiDecisionsQuestion)")
|
|
} else if match == 1 {
|
|
return nil // exactly one match
|
|
} else { // no match
|
|
return fmt.Errorf("data failed to match schemas in oneOf(AiDecisionsQuestion)")
|
|
}
|
|
}
|
|
|
|
// Marshal data from the first non-nil pointers in the struct to JSON
|
|
func (src AiDecisionsQuestion) MarshalJSON() ([]byte, error) {
|
|
if src.AiDecisionsBoolean != nil {
|
|
return json.Marshal(&src.AiDecisionsBoolean)
|
|
}
|
|
|
|
if src.AiDecisionsChoice != nil {
|
|
return json.Marshal(&src.AiDecisionsChoice)
|
|
}
|
|
|
|
if src.AiDecisionsNoul != nil {
|
|
return json.Marshal(&src.AiDecisionsNoul)
|
|
}
|
|
|
|
if src.AiDecisionsScore != nil {
|
|
return json.Marshal(&src.AiDecisionsScore)
|
|
}
|
|
|
|
return nil, nil // no data in oneOf schemas
|
|
}
|
|
|
|
// Get the actual instance
|
|
func (obj *AiDecisionsQuestion) GetActualInstance() interface{} {
|
|
if obj == nil {
|
|
return nil
|
|
}
|
|
if obj.AiDecisionsBoolean != nil {
|
|
return obj.AiDecisionsBoolean
|
|
}
|
|
|
|
if obj.AiDecisionsChoice != nil {
|
|
return obj.AiDecisionsChoice
|
|
}
|
|
|
|
if obj.AiDecisionsNoul != nil {
|
|
return obj.AiDecisionsNoul
|
|
}
|
|
|
|
if obj.AiDecisionsScore != nil {
|
|
return obj.AiDecisionsScore
|
|
}
|
|
|
|
// all schemas are nil
|
|
return nil
|
|
}
|
|
|
|
// Get the actual instance value
|
|
func (obj AiDecisionsQuestion) GetActualInstanceValue() interface{} {
|
|
if obj.AiDecisionsBoolean != nil {
|
|
return *obj.AiDecisionsBoolean
|
|
}
|
|
|
|
if obj.AiDecisionsChoice != nil {
|
|
return *obj.AiDecisionsChoice
|
|
}
|
|
|
|
if obj.AiDecisionsNoul != nil {
|
|
return *obj.AiDecisionsNoul
|
|
}
|
|
|
|
if obj.AiDecisionsScore != nil {
|
|
return *obj.AiDecisionsScore
|
|
}
|
|
|
|
// all schemas are nil
|
|
return nil
|
|
}
|
|
|
|
type NullableAiDecisionsQuestion struct {
|
|
value *AiDecisionsQuestion
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableAiDecisionsQuestion) Get() *AiDecisionsQuestion {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableAiDecisionsQuestion) Set(val *AiDecisionsQuestion) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableAiDecisionsQuestion) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableAiDecisionsQuestion) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableAiDecisionsQuestion(val *AiDecisionsQuestion) *NullableAiDecisionsQuestion {
|
|
return &NullableAiDecisionsQuestion{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableAiDecisionsQuestion) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableAiDecisionsQuestion) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|