1 Star 0 Fork 0

MrCoder/openapi

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
model_intent_single_all_of_intent_expectations.go 5.45 KB
一键复制 编辑 原始数据 按行查看 历史
MrCoder 提交于 2023-12-22 15:27 +08:00 . update
/*
Provisioning MnS
OAS 3.0.1 definition of the Provisioning MnS © 2023, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
API version: 17.6.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package OpenAPI_ProvMnS
import (
"encoding/json"
"fmt"
)
// IntentSingleAllOfIntentExpectations - struct for IntentSingleAllOfIntentExpectations
type IntentSingleAllOfIntentExpectations struct {
EdgeServiceSupportExpectation *EdgeServiceSupportExpectation
IntentExpectation *IntentExpectation
RadioNetworkExpectation *RadioNetworkExpectation
}
// EdgeServiceSupportExpectationAsIntentSingleAllOfIntentExpectations is a convenience function that returns EdgeServiceSupportExpectation wrapped in IntentSingleAllOfIntentExpectations
func EdgeServiceSupportExpectationAsIntentSingleAllOfIntentExpectations(v *EdgeServiceSupportExpectation) IntentSingleAllOfIntentExpectations {
return IntentSingleAllOfIntentExpectations{
EdgeServiceSupportExpectation: v,
}
}
// IntentExpectationAsIntentSingleAllOfIntentExpectations is a convenience function that returns IntentExpectation wrapped in IntentSingleAllOfIntentExpectations
func IntentExpectationAsIntentSingleAllOfIntentExpectations(v *IntentExpectation) IntentSingleAllOfIntentExpectations {
return IntentSingleAllOfIntentExpectations{
IntentExpectation: v,
}
}
// RadioNetworkExpectationAsIntentSingleAllOfIntentExpectations is a convenience function that returns RadioNetworkExpectation wrapped in IntentSingleAllOfIntentExpectations
func RadioNetworkExpectationAsIntentSingleAllOfIntentExpectations(v *RadioNetworkExpectation) IntentSingleAllOfIntentExpectations {
return IntentSingleAllOfIntentExpectations{
RadioNetworkExpectation: v,
}
}
// Unmarshal JSON data into one of the pointers in the struct
func (dst *IntentSingleAllOfIntentExpectations) UnmarshalJSON(data []byte) error {
var err error
match := 0
// try to unmarshal data into EdgeServiceSupportExpectation
err = newStrictDecoder(data).Decode(&dst.EdgeServiceSupportExpectation)
if err == nil {
jsonEdgeServiceSupportExpectation, _ := json.Marshal(dst.EdgeServiceSupportExpectation)
if string(jsonEdgeServiceSupportExpectation) == "{}" { // empty struct
dst.EdgeServiceSupportExpectation = nil
} else {
match++
}
} else {
dst.EdgeServiceSupportExpectation = nil
}
// try to unmarshal data into IntentExpectation
err = newStrictDecoder(data).Decode(&dst.IntentExpectation)
if err == nil {
jsonIntentExpectation, _ := json.Marshal(dst.IntentExpectation)
if string(jsonIntentExpectation) == "{}" { // empty struct
dst.IntentExpectation = nil
} else {
match++
}
} else {
dst.IntentExpectation = nil
}
// try to unmarshal data into RadioNetworkExpectation
err = newStrictDecoder(data).Decode(&dst.RadioNetworkExpectation)
if err == nil {
jsonRadioNetworkExpectation, _ := json.Marshal(dst.RadioNetworkExpectation)
if string(jsonRadioNetworkExpectation) == "{}" { // empty struct
dst.RadioNetworkExpectation = nil
} else {
match++
}
} else {
dst.RadioNetworkExpectation = nil
}
if match > 1 { // more than 1 match
// reset to nil
dst.EdgeServiceSupportExpectation = nil
dst.IntentExpectation = nil
dst.RadioNetworkExpectation = nil
return fmt.Errorf("data matches more than one schema in oneOf(IntentSingleAllOfIntentExpectations)")
} else if match == 1 {
return nil // exactly one match
} else { // no match
return fmt.Errorf("data failed to match schemas in oneOf(IntentSingleAllOfIntentExpectations)")
}
}
// Marshal data from the first non-nil pointers in the struct to JSON
func (src IntentSingleAllOfIntentExpectations) MarshalJSON() ([]byte, error) {
if src.EdgeServiceSupportExpectation != nil {
return json.Marshal(&src.EdgeServiceSupportExpectation)
}
if src.IntentExpectation != nil {
return json.Marshal(&src.IntentExpectation)
}
if src.RadioNetworkExpectation != nil {
return json.Marshal(&src.RadioNetworkExpectation)
}
return nil, nil // no data in oneOf schemas
}
// Get the actual instance
func (obj *IntentSingleAllOfIntentExpectations) GetActualInstance() interface{} {
if obj == nil {
return nil
}
if obj.EdgeServiceSupportExpectation != nil {
return obj.EdgeServiceSupportExpectation
}
if obj.IntentExpectation != nil {
return obj.IntentExpectation
}
if obj.RadioNetworkExpectation != nil {
return obj.RadioNetworkExpectation
}
// all schemas are nil
return nil
}
type NullableIntentSingleAllOfIntentExpectations struct {
value *IntentSingleAllOfIntentExpectations
isSet bool
}
func (v NullableIntentSingleAllOfIntentExpectations) Get() *IntentSingleAllOfIntentExpectations {
return v.value
}
func (v *NullableIntentSingleAllOfIntentExpectations) Set(val *IntentSingleAllOfIntentExpectations) {
v.value = val
v.isSet = true
}
func (v NullableIntentSingleAllOfIntentExpectations) IsSet() bool {
return v.isSet
}
func (v *NullableIntentSingleAllOfIntentExpectations) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableIntentSingleAllOfIntentExpectations(val *IntentSingleAllOfIntentExpectations) *NullableIntentSingleAllOfIntentExpectations {
return &NullableIntentSingleAllOfIntentExpectations{value: val, isSet: true}
}
func (v NullableIntentSingleAllOfIntentExpectations) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableIntentSingleAllOfIntentExpectations) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/konglinglong/openapi.git
git@gitee.com:konglinglong/openapi.git
konglinglong
openapi
openapi
e403a3c726a4

搜索帮助