mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
104 lines
2.5 KiB
Go
104 lines
2.5 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"
|
|
)
|
|
|
|
// AiDecisionsReasonCode struct for AiDecisionsReasonCode
|
|
type AiDecisionsReasonCode struct {
|
|
Int32 *int32
|
|
String *string
|
|
}
|
|
|
|
// Unmarshal JSON data into any of the pointers in the struct
|
|
func (dst *AiDecisionsReasonCode) UnmarshalJSON(data []byte) error {
|
|
var err error
|
|
// try to unmarshal JSON data into Int32
|
|
err = json.Unmarshal(data, &dst.Int32)
|
|
if err == nil {
|
|
jsonInt32, _ := json.Marshal(dst.Int32)
|
|
if string(jsonInt32) == "{}" { // empty struct
|
|
dst.Int32 = nil
|
|
} else {
|
|
return nil // data stored in dst.Int32, return on the first match
|
|
}
|
|
} else {
|
|
dst.Int32 = nil
|
|
}
|
|
|
|
// try to unmarshal JSON data into String
|
|
err = json.Unmarshal(data, &dst.String)
|
|
if err == nil {
|
|
jsonString, _ := json.Marshal(dst.String)
|
|
if string(jsonString) == "{}" { // empty struct
|
|
dst.String = nil
|
|
} else {
|
|
return nil // data stored in dst.String, return on the first match
|
|
}
|
|
} else {
|
|
dst.String = nil
|
|
}
|
|
|
|
return fmt.Errorf("data failed to match schemas in anyOf(AiDecisionsReasonCode)")
|
|
}
|
|
|
|
// Marshal data from the first non-nil pointers in the struct to JSON
|
|
func (src AiDecisionsReasonCode) MarshalJSON() ([]byte, error) {
|
|
if src.Int32 != nil {
|
|
return json.Marshal(&src.Int32)
|
|
}
|
|
|
|
if src.String != nil {
|
|
return json.Marshal(&src.String)
|
|
}
|
|
|
|
return nil, nil // no data in anyOf schemas
|
|
}
|
|
|
|
type NullableAiDecisionsReasonCode struct {
|
|
value *AiDecisionsReasonCode
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableAiDecisionsReasonCode) Get() *AiDecisionsReasonCode {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableAiDecisionsReasonCode) Set(val *AiDecisionsReasonCode) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableAiDecisionsReasonCode) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableAiDecisionsReasonCode) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableAiDecisionsReasonCode(val *AiDecisionsReasonCode) *NullableAiDecisionsReasonCode {
|
|
return &NullableAiDecisionsReasonCode{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableAiDecisionsReasonCode) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableAiDecisionsReasonCode) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|