/* STACKIT Git API STACKIT Git management API. API version: 1beta.0.4 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package gitbeta import ( "encoding/json" "fmt" ) // checks if the FeatureToggle type satisfies the MappedNullable interface at compile time var _ MappedNullable = &FeatureToggle{} /* types and functions for default_email_notifications */ // isEnum // FeatureToggleDefaultEmailNotifications Default email notifications. // value type for enums type FeatureToggleDefaultEmailNotifications string // List of DefaultEmailNotifications const ( FEATURETOGGLEDEFAULT_EMAIL_NOTIFICATIONS_ENABLED FeatureToggleDefaultEmailNotifications = "enabled" FEATURETOGGLEDEFAULT_EMAIL_NOTIFICATIONS_DISABLED FeatureToggleDefaultEmailNotifications = "disabled" FEATURETOGGLEDEFAULT_EMAIL_NOTIFICATIONS_ONMENTION FeatureToggleDefaultEmailNotifications = "onmention" FEATURETOGGLEDEFAULT_EMAIL_NOTIFICATIONS_ANDYOUROWN FeatureToggleDefaultEmailNotifications = "andyourown" ) // All allowed values of FeatureToggle enum var AllowedFeatureToggleDefaultEmailNotificationsEnumValues = []FeatureToggleDefaultEmailNotifications{ "enabled", "disabled", "onmention", "andyourown", } func (v *FeatureToggleDefaultEmailNotifications) UnmarshalJSON(src []byte) error { // use a type alias to prevent infinite recursion during unmarshal, // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers type TmpJson FeatureToggleDefaultEmailNotifications var value TmpJson err := json.Unmarshal(src, &value) if err != nil { return err } // Allow unmarshalling zero value for testing purposes var zeroValue TmpJson if value == zeroValue { return nil } enumTypeValue := FeatureToggleDefaultEmailNotifications(value) for _, existing := range AllowedFeatureToggleDefaultEmailNotificationsEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil } } return fmt.Errorf("%+v is not a valid FeatureToggle", value) } // NewFeatureToggleDefaultEmailNotificationsFromValue returns a pointer to a valid FeatureToggleDefaultEmailNotifications // for the value passed as argument, or an error if the value passed is not allowed by the enum func NewFeatureToggleDefaultEmailNotificationsFromValue(v FeatureToggleDefaultEmailNotifications) (*FeatureToggleDefaultEmailNotifications, error) { ev := FeatureToggleDefaultEmailNotifications(v) if ev.IsValid() { return &ev, nil } else { return nil, fmt.Errorf("invalid value '%v' for FeatureToggleDefaultEmailNotifications: valid values are %v", v, AllowedFeatureToggleDefaultEmailNotificationsEnumValues) } } // IsValid return true if the value is valid for the enum, false otherwise func (v FeatureToggleDefaultEmailNotifications) IsValid() bool { for _, existing := range AllowedFeatureToggleDefaultEmailNotificationsEnumValues { if existing == v { return true } } return false } // Ptr returns reference to DefaultEmailNotificationsDefaultEmailNotifications value func (v FeatureToggleDefaultEmailNotifications) Ptr() *FeatureToggleDefaultEmailNotifications { return &v } type NullableFeatureToggleDefaultEmailNotifications struct { value *FeatureToggleDefaultEmailNotifications isSet bool } func (v NullableFeatureToggleDefaultEmailNotifications) Get() *FeatureToggleDefaultEmailNotifications { return v.value } func (v *NullableFeatureToggleDefaultEmailNotifications) Set(val *FeatureToggleDefaultEmailNotifications) { v.value = val v.isSet = true } func (v NullableFeatureToggleDefaultEmailNotifications) IsSet() bool { return v.isSet } func (v *NullableFeatureToggleDefaultEmailNotifications) Unset() { v.value = nil v.isSet = false } func NewNullableFeatureToggleDefaultEmailNotifications(val *FeatureToggleDefaultEmailNotifications) *NullableFeatureToggleDefaultEmailNotifications { return &NullableFeatureToggleDefaultEmailNotifications{value: val, isSet: true} } func (v NullableFeatureToggleDefaultEmailNotifications) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableFeatureToggleDefaultEmailNotifications) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } type FeatureToggleGetDefaultEmailNotificationsAttributeType = *FeatureToggleDefaultEmailNotifications type FeatureToggleGetDefaultEmailNotificationsArgType = *FeatureToggleDefaultEmailNotifications type FeatureToggleGetDefaultEmailNotificationsRetType = *FeatureToggleDefaultEmailNotifications func getFeatureToggleGetDefaultEmailNotificationsAttributeTypeOk(arg FeatureToggleGetDefaultEmailNotificationsAttributeType) (ret FeatureToggleGetDefaultEmailNotificationsRetType, ok bool) { if arg == nil { return nil, false } return arg, true } func setFeatureToggleGetDefaultEmailNotificationsAttributeType(arg *FeatureToggleGetDefaultEmailNotificationsAttributeType, val FeatureToggleGetDefaultEmailNotificationsRetType) { *arg = val } /* types and functions for enable_commit_signatures */ // isBoolean type FeatureTogglegetEnableCommitSignaturesAttributeType = *bool type FeatureTogglegetEnableCommitSignaturesArgType = *bool type FeatureTogglegetEnableCommitSignaturesRetType = *bool func getFeatureTogglegetEnableCommitSignaturesAttributeTypeOk(arg FeatureTogglegetEnableCommitSignaturesAttributeType) (ret FeatureTogglegetEnableCommitSignaturesRetType, ok bool) { if arg == nil { return nil, false } return arg, true } func setFeatureTogglegetEnableCommitSignaturesAttributeType(arg *FeatureTogglegetEnableCommitSignaturesAttributeType, val FeatureTogglegetEnableCommitSignaturesRetType) { *arg = val } /* types and functions for enable_local_login */ // isBoolean type FeatureTogglegetEnableLocalLoginAttributeType = *bool type FeatureTogglegetEnableLocalLoginArgType = *bool type FeatureTogglegetEnableLocalLoginRetType = *bool func getFeatureTogglegetEnableLocalLoginAttributeTypeOk(arg FeatureTogglegetEnableLocalLoginAttributeType) (ret FeatureTogglegetEnableLocalLoginRetType, ok bool) { if arg == nil { return nil, false } return arg, true } func setFeatureTogglegetEnableLocalLoginAttributeType(arg *FeatureTogglegetEnableLocalLoginAttributeType, val FeatureTogglegetEnableLocalLoginRetType) { *arg = val } // FeatureToggle Feature toggles for the instance. type FeatureToggle struct { // Default email notifications. DefaultEmailNotifications FeatureToggleGetDefaultEmailNotificationsAttributeType `json:"default_email_notifications,omitempty"` // Enable commit signatures. EnableCommitSignatures FeatureTogglegetEnableCommitSignaturesAttributeType `json:"enable_commit_signatures,omitempty"` // Enable local login. EnableLocalLogin FeatureTogglegetEnableLocalLoginAttributeType `json:"enable_local_login,omitempty"` } // NewFeatureToggle instantiates a new FeatureToggle 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 NewFeatureToggle() *FeatureToggle { this := FeatureToggle{} return &this } // NewFeatureToggleWithDefaults instantiates a new FeatureToggle 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 NewFeatureToggleWithDefaults() *FeatureToggle { this := FeatureToggle{} return &this } // GetDefaultEmailNotifications returns the DefaultEmailNotifications field value if set, zero value otherwise (both if not set or set to explicit null). func (o *FeatureToggle) GetDefaultEmailNotifications() (res FeatureToggleGetDefaultEmailNotificationsRetType) { res, _ = o.GetDefaultEmailNotificationsOk() return } // GetDefaultEmailNotificationsOk returns a tuple with the DefaultEmailNotifications 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 *FeatureToggle) GetDefaultEmailNotificationsOk() (ret FeatureToggleGetDefaultEmailNotificationsRetType, ok bool) { return getFeatureToggleGetDefaultEmailNotificationsAttributeTypeOk(o.DefaultEmailNotifications) } // HasDefaultEmailNotifications returns a boolean if a field has been set. func (o *FeatureToggle) HasDefaultEmailNotifications() bool { _, ok := o.GetDefaultEmailNotificationsOk() return ok } // SetDefaultEmailNotifications gets a reference to the given string and assigns it to the DefaultEmailNotifications field. func (o *FeatureToggle) SetDefaultEmailNotifications(v FeatureToggleGetDefaultEmailNotificationsRetType) { setFeatureToggleGetDefaultEmailNotificationsAttributeType(&o.DefaultEmailNotifications, v) } // SetDefaultEmailNotificationsNil sets the value for DefaultEmailNotifications to be an explicit nil func (o *FeatureToggle) SetDefaultEmailNotificationsNil() { o.DefaultEmailNotifications = nil } // UnsetDefaultEmailNotifications ensures that no value is present for DefaultEmailNotifications, not even an explicit nil func (o *FeatureToggle) UnsetDefaultEmailNotifications() { o.DefaultEmailNotifications = nil } // GetEnableCommitSignatures returns the EnableCommitSignatures field value if set, zero value otherwise (both if not set or set to explicit null). func (o *FeatureToggle) GetEnableCommitSignatures() (res FeatureTogglegetEnableCommitSignaturesRetType) { res, _ = o.GetEnableCommitSignaturesOk() return } // GetEnableCommitSignaturesOk returns a tuple with the EnableCommitSignatures 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 *FeatureToggle) GetEnableCommitSignaturesOk() (ret FeatureTogglegetEnableCommitSignaturesRetType, ok bool) { return getFeatureTogglegetEnableCommitSignaturesAttributeTypeOk(o.EnableCommitSignatures) } // HasEnableCommitSignatures returns a boolean if a field has been set. func (o *FeatureToggle) HasEnableCommitSignatures() bool { _, ok := o.GetEnableCommitSignaturesOk() return ok } // SetEnableCommitSignatures gets a reference to the given bool and assigns it to the EnableCommitSignatures field. func (o *FeatureToggle) SetEnableCommitSignatures(v FeatureTogglegetEnableCommitSignaturesRetType) { setFeatureTogglegetEnableCommitSignaturesAttributeType(&o.EnableCommitSignatures, v) } // SetEnableCommitSignaturesNil sets the value for EnableCommitSignatures to be an explicit nil func (o *FeatureToggle) SetEnableCommitSignaturesNil() { o.EnableCommitSignatures = nil } // UnsetEnableCommitSignatures ensures that no value is present for EnableCommitSignatures, not even an explicit nil func (o *FeatureToggle) UnsetEnableCommitSignatures() { o.EnableCommitSignatures = nil } // GetEnableLocalLogin returns the EnableLocalLogin field value if set, zero value otherwise (both if not set or set to explicit null). func (o *FeatureToggle) GetEnableLocalLogin() (res FeatureTogglegetEnableLocalLoginRetType) { res, _ = o.GetEnableLocalLoginOk() return } // GetEnableLocalLoginOk returns a tuple with the EnableLocalLogin 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 *FeatureToggle) GetEnableLocalLoginOk() (ret FeatureTogglegetEnableLocalLoginRetType, ok bool) { return getFeatureTogglegetEnableLocalLoginAttributeTypeOk(o.EnableLocalLogin) } // HasEnableLocalLogin returns a boolean if a field has been set. func (o *FeatureToggle) HasEnableLocalLogin() bool { _, ok := o.GetEnableLocalLoginOk() return ok } // SetEnableLocalLogin gets a reference to the given bool and assigns it to the EnableLocalLogin field. func (o *FeatureToggle) SetEnableLocalLogin(v FeatureTogglegetEnableLocalLoginRetType) { setFeatureTogglegetEnableLocalLoginAttributeType(&o.EnableLocalLogin, v) } // SetEnableLocalLoginNil sets the value for EnableLocalLogin to be an explicit nil func (o *FeatureToggle) SetEnableLocalLoginNil() { o.EnableLocalLogin = nil } // UnsetEnableLocalLogin ensures that no value is present for EnableLocalLogin, not even an explicit nil func (o *FeatureToggle) UnsetEnableLocalLogin() { o.EnableLocalLogin = nil } func (o FeatureToggle) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getFeatureToggleGetDefaultEmailNotificationsAttributeTypeOk(o.DefaultEmailNotifications); ok { toSerialize["DefaultEmailNotifications"] = val } if val, ok := getFeatureTogglegetEnableCommitSignaturesAttributeTypeOk(o.EnableCommitSignatures); ok { toSerialize["EnableCommitSignatures"] = val } if val, ok := getFeatureTogglegetEnableLocalLoginAttributeTypeOk(o.EnableLocalLogin); ok { toSerialize["EnableLocalLogin"] = val } return toSerialize, nil } type NullableFeatureToggle struct { value *FeatureToggle isSet bool } func (v NullableFeatureToggle) Get() *FeatureToggle { return v.value } func (v *NullableFeatureToggle) Set(val *FeatureToggle) { v.value = val v.isSet = true } func (v NullableFeatureToggle) IsSet() bool { return v.isSet } func (v *NullableFeatureToggle) Unset() { v.value = nil v.isSet = false } func NewNullableFeatureToggle(val *FeatureToggle) *NullableFeatureToggle { return &NullableFeatureToggle{value: val, isSet: true} } func (v NullableFeatureToggle) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableFeatureToggle) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }