Files
openapi-go-answer/model_constant_notification_channel_key.go
2023-09-26 16:20:01 +08:00

108 lines
3.0 KiB
Go

/*
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
API version: 1.0.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package answer_sdk
import (
"encoding/json"
"fmt"
)
// ConstantNotificationChannelKey the model 'ConstantNotificationChannelKey'
type ConstantNotificationChannelKey string
// List of constant.NotificationChannelKey
const (
EmailChannel ConstantNotificationChannelKey = "email"
)
// All allowed values of ConstantNotificationChannelKey enum
var AllowedConstantNotificationChannelKeyEnumValues = []ConstantNotificationChannelKey{
"email",
}
func (v *ConstantNotificationChannelKey) UnmarshalJSON(src []byte) error {
var value string
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
enumTypeValue := ConstantNotificationChannelKey(value)
for _, existing := range AllowedConstantNotificationChannelKeyEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid ConstantNotificationChannelKey", value)
}
// NewConstantNotificationChannelKeyFromValue returns a pointer to a valid ConstantNotificationChannelKey
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewConstantNotificationChannelKeyFromValue(v string) (*ConstantNotificationChannelKey, error) {
ev := ConstantNotificationChannelKey(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for ConstantNotificationChannelKey: valid values are %v", v, AllowedConstantNotificationChannelKeyEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v ConstantNotificationChannelKey) IsValid() bool {
for _, existing := range AllowedConstantNotificationChannelKeyEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to constant.NotificationChannelKey value
func (v ConstantNotificationChannelKey) Ptr() *ConstantNotificationChannelKey {
return &v
}
type NullableConstantNotificationChannelKey struct {
value *ConstantNotificationChannelKey
isSet bool
}
func (v NullableConstantNotificationChannelKey) Get() *ConstantNotificationChannelKey {
return v.value
}
func (v *NullableConstantNotificationChannelKey) Set(val *ConstantNotificationChannelKey) {
v.value = val
v.isSet = true
}
func (v NullableConstantNotificationChannelKey) IsSet() bool {
return v.isSet
}
func (v *NullableConstantNotificationChannelKey) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableConstantNotificationChannelKey(val *ConstantNotificationChannelKey) *NullableConstantNotificationChannelKey {
return &NullableConstantNotificationChannelKey{value: val, isSet: true}
}
func (v NullableConstantNotificationChannelKey) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableConstantNotificationChannelKey) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}