/* authentik Making authentication simple. API version: 2026.5.0-rc1 Contact: hello@goauthentik.io */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package api import ( "encoding/json" "fmt" ) // checks if the GenericError type satisfies the MappedNullable interface at compile time var _ MappedNullable = &GenericError{} // GenericError Generic API Error type GenericError struct { Detail string `json:"detail"` Code *string `json:"code,omitempty"` AdditionalProperties map[string]interface{} } type _GenericError GenericError // NewGenericError instantiates a new GenericError 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 NewGenericError(detail string) *GenericError { this := GenericError{} this.Detail = detail return &this } // NewGenericErrorWithDefaults instantiates a new GenericError 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 NewGenericErrorWithDefaults() *GenericError { this := GenericError{} return &this } // GetDetail returns the Detail field value func (o *GenericError) GetDetail() string { if o == nil { var ret string return ret } return o.Detail } // GetDetailOk returns a tuple with the Detail field value // and a boolean to check if the value has been set. func (o *GenericError) GetDetailOk() (*string, bool) { if o == nil { return nil, false } return &o.Detail, true } // SetDetail sets field value func (o *GenericError) SetDetail(v string) { o.Detail = v } // GetCode returns the Code field value if set, zero value otherwise. func (o *GenericError) GetCode() string { if o == nil || IsNil(o.Code) { var ret string return ret } return *o.Code } // GetCodeOk returns a tuple with the Code field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *GenericError) GetCodeOk() (*string, bool) { if o == nil || IsNil(o.Code) { return nil, false } return o.Code, true } // HasCode returns a boolean if a field has been set. func (o *GenericError) HasCode() bool { if o != nil && !IsNil(o.Code) { return true } return false } // SetCode gets a reference to the given string and assigns it to the Code field. func (o *GenericError) SetCode(v string) { o.Code = &v } func (o GenericError) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } return json.Marshal(toSerialize) } func (o GenericError) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["detail"] = o.Detail if !IsNil(o.Code) { toSerialize["code"] = o.Code } for key, value := range o.AdditionalProperties { toSerialize[key] = value } return toSerialize, nil } func (o *GenericError) UnmarshalJSON(data []byte) (err error) { // This validates that all required properties are included in the JSON object // by unmarshalling the object into a generic map with string keys and checking // that every required field exists as a key in the generic map. requiredProperties := []string{ "detail", } allProperties := make(map[string]interface{}) err = json.Unmarshal(data, &allProperties) if err != nil { return err } for _, requiredProperty := range requiredProperties { if _, exists := allProperties[requiredProperty]; !exists { return fmt.Errorf("no value given for required property %v", requiredProperty) } } varGenericError := _GenericError{} err = json.Unmarshal(data, &varGenericError) if err != nil { return err } *o = GenericError(varGenericError) additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(data, &additionalProperties); err == nil { delete(additionalProperties, "detail") delete(additionalProperties, "code") o.AdditionalProperties = additionalProperties } return err } type NullableGenericError struct { value *GenericError isSet bool } func (v NullableGenericError) Get() *GenericError { return v.value } func (v *NullableGenericError) Set(val *GenericError) { v.value = val v.isSet = true } func (v NullableGenericError) IsSet() bool { return v.isSet } func (v *NullableGenericError) Unset() { v.value = nil v.isSet = false } func NewNullableGenericError(val *GenericError) *NullableGenericError { return &NullableGenericError{value: val, isSet: true} } func (v NullableGenericError) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableGenericError) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }