/* FastAPI No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) API version: 0.1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package openapi import ( "encoding/json" "bytes" "fmt" ) // checks if the AccessAuthorizationCreate type satisfies the MappedNullable interface at compile time var _ MappedNullable = &AccessAuthorizationCreate{} // AccessAuthorizationCreate struct for AccessAuthorizationCreate type AccessAuthorizationCreate struct { Name string `json:"name"` Type string `json:"type"` IsActive bool `json:"is_active"` Timetables []TimetableCreate `json:"timetables,omitempty"` Oneshot NullableOneShotAccessBase `json:"oneshot,omitempty"` } type _AccessAuthorizationCreate AccessAuthorizationCreate // NewAccessAuthorizationCreate instantiates a new AccessAuthorizationCreate 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 NewAccessAuthorizationCreate(name string, type_ string, isActive bool) *AccessAuthorizationCreate { this := AccessAuthorizationCreate{} this.Name = name this.Type = type_ this.IsActive = isActive return &this } // NewAccessAuthorizationCreateWithDefaults instantiates a new AccessAuthorizationCreate 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 NewAccessAuthorizationCreateWithDefaults() *AccessAuthorizationCreate { this := AccessAuthorizationCreate{} return &this } // GetName returns the Name field value func (o *AccessAuthorizationCreate) GetName() string { if o == nil { var ret string return ret } return o.Name } // GetNameOk returns a tuple with the Name field value // and a boolean to check if the value has been set. func (o *AccessAuthorizationCreate) GetNameOk() (*string, bool) { if o == nil { return nil, false } return &o.Name, true } // SetName sets field value func (o *AccessAuthorizationCreate) SetName(v string) { o.Name = v } // GetType returns the Type field value func (o *AccessAuthorizationCreate) GetType() string { if o == nil { var ret string return ret } return o.Type } // GetTypeOk returns a tuple with the Type field value // and a boolean to check if the value has been set. func (o *AccessAuthorizationCreate) GetTypeOk() (*string, bool) { if o == nil { return nil, false } return &o.Type, true } // SetType sets field value func (o *AccessAuthorizationCreate) SetType(v string) { o.Type = v } // GetIsActive returns the IsActive field value func (o *AccessAuthorizationCreate) GetIsActive() bool { if o == nil { var ret bool return ret } return o.IsActive } // GetIsActiveOk returns a tuple with the IsActive field value // and a boolean to check if the value has been set. func (o *AccessAuthorizationCreate) GetIsActiveOk() (*bool, bool) { if o == nil { return nil, false } return &o.IsActive, true } // SetIsActive sets field value func (o *AccessAuthorizationCreate) SetIsActive(v bool) { o.IsActive = v } // GetTimetables returns the Timetables field value if set, zero value otherwise. func (o *AccessAuthorizationCreate) GetTimetables() []TimetableCreate { if o == nil || IsNil(o.Timetables) { var ret []TimetableCreate return ret } return o.Timetables } // GetTimetablesOk returns a tuple with the Timetables field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *AccessAuthorizationCreate) GetTimetablesOk() ([]TimetableCreate, bool) { if o == nil || IsNil(o.Timetables) { return nil, false } return o.Timetables, true } // HasTimetables returns a boolean if a field has been set. func (o *AccessAuthorizationCreate) HasTimetables() bool { if o != nil && !IsNil(o.Timetables) { return true } return false } // SetTimetables gets a reference to the given []TimetableCreate and assigns it to the Timetables field. func (o *AccessAuthorizationCreate) SetTimetables(v []TimetableCreate) { o.Timetables = v } // GetOneshot returns the Oneshot field value if set, zero value otherwise (both if not set or set to explicit null). func (o *AccessAuthorizationCreate) GetOneshot() OneShotAccessBase { if o == nil || IsNil(o.Oneshot.Get()) { var ret OneShotAccessBase return ret } return *o.Oneshot.Get() } // GetOneshotOk returns a tuple with the Oneshot 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 *AccessAuthorizationCreate) GetOneshotOk() (*OneShotAccessBase, bool) { if o == nil { return nil, false } return o.Oneshot.Get(), o.Oneshot.IsSet() } // HasOneshot returns a boolean if a field has been set. func (o *AccessAuthorizationCreate) HasOneshot() bool { if o != nil && o.Oneshot.IsSet() { return true } return false } // SetOneshot gets a reference to the given NullableOneShotAccessBase and assigns it to the Oneshot field. func (o *AccessAuthorizationCreate) SetOneshot(v OneShotAccessBase) { o.Oneshot.Set(&v) } // SetOneshotNil sets the value for Oneshot to be an explicit nil func (o *AccessAuthorizationCreate) SetOneshotNil() { o.Oneshot.Set(nil) } // UnsetOneshot ensures that no value is present for Oneshot, not even an explicit nil func (o *AccessAuthorizationCreate) UnsetOneshot() { o.Oneshot.Unset() } func (o AccessAuthorizationCreate) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } return json.Marshal(toSerialize) } func (o AccessAuthorizationCreate) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["name"] = o.Name toSerialize["type"] = o.Type toSerialize["is_active"] = o.IsActive if !IsNil(o.Timetables) { toSerialize["timetables"] = o.Timetables } if o.Oneshot.IsSet() { toSerialize["oneshot"] = o.Oneshot.Get() } return toSerialize, nil } func (o *AccessAuthorizationCreate) 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{ "name", "type", "is_active", } 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) } } varAccessAuthorizationCreate := _AccessAuthorizationCreate{} decoder := json.NewDecoder(bytes.NewReader(data)) decoder.DisallowUnknownFields() err = decoder.Decode(&varAccessAuthorizationCreate) if err != nil { return err } *o = AccessAuthorizationCreate(varAccessAuthorizationCreate) return err } type NullableAccessAuthorizationCreate struct { value *AccessAuthorizationCreate isSet bool } func (v NullableAccessAuthorizationCreate) Get() *AccessAuthorizationCreate { return v.value } func (v *NullableAccessAuthorizationCreate) Set(val *AccessAuthorizationCreate) { v.value = val v.isSet = true } func (v NullableAccessAuthorizationCreate) IsSet() bool { return v.isSet } func (v *NullableAccessAuthorizationCreate) Unset() { v.value = nil v.isSet = false } func NewNullableAccessAuthorizationCreate(val *AccessAuthorizationCreate) *NullableAccessAuthorizationCreate { return &NullableAccessAuthorizationCreate{value: val, isSet: true} } func (v NullableAccessAuthorizationCreate) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableAccessAuthorizationCreate) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }