/* Ory Identities API This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. API version: Contact: office@ory.sh */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( "encoding/json" "fmt" ) // checks if the ManageSessionsBody type satisfies the MappedNullable interface at compile time var _ MappedNullable = &ManageSessionsBody{} // ManageSessionsBody Body for the bulk session management endpoint. Exactly one of `identities` or `sessions` must be provided. To operate on every session in the network, pass `identities: [\"*\"]` — the wildcard must appear alone, never mixed with explicit IDs. type ManageSessionsBody struct { // Action to perform on the matching sessions. disable ManageSessionsActionDisable delete ManageSessionsActionDelete Action string `json:"action"` // Identity IDs whose sessions should be disabled or deleted, or `[\"*\"]` to operate on every session in the network. Mutually exclusive with `sessions`. Identities []string `json:"identities,omitempty"` // Session IDs to disable or delete. Mutually exclusive with `identities`. The wildcard `[\"*\"]` is not accepted in this field — pass `identities: [\"*\"]` to scope the operation to every session in the network. Sessions []string `json:"sessions,omitempty"` AdditionalProperties map[string]interface{} } type _ManageSessionsBody ManageSessionsBody // NewManageSessionsBody instantiates a new ManageSessionsBody 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 NewManageSessionsBody(action string) *ManageSessionsBody { this := ManageSessionsBody{} this.Action = action return &this } // NewManageSessionsBodyWithDefaults instantiates a new ManageSessionsBody 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 NewManageSessionsBodyWithDefaults() *ManageSessionsBody { this := ManageSessionsBody{} return &this } // GetAction returns the Action field value func (o *ManageSessionsBody) GetAction() string { if o == nil { var ret string return ret } return o.Action } // GetActionOk returns a tuple with the Action field value // and a boolean to check if the value has been set. func (o *ManageSessionsBody) GetActionOk() (*string, bool) { if o == nil { return nil, false } return &o.Action, true } // SetAction sets field value func (o *ManageSessionsBody) SetAction(v string) { o.Action = v } // GetIdentities returns the Identities field value if set, zero value otherwise. func (o *ManageSessionsBody) GetIdentities() []string { if o == nil || IsNil(o.Identities) { var ret []string return ret } return o.Identities } // GetIdentitiesOk returns a tuple with the Identities field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ManageSessionsBody) GetIdentitiesOk() ([]string, bool) { if o == nil || IsNil(o.Identities) { return nil, false } return o.Identities, true } // HasIdentities returns a boolean if a field has been set. func (o *ManageSessionsBody) HasIdentities() bool { if o != nil && !IsNil(o.Identities) { return true } return false } // SetIdentities gets a reference to the given []string and assigns it to the Identities field. func (o *ManageSessionsBody) SetIdentities(v []string) { o.Identities = v } // GetSessions returns the Sessions field value if set, zero value otherwise. func (o *ManageSessionsBody) GetSessions() []string { if o == nil || IsNil(o.Sessions) { var ret []string return ret } return o.Sessions } // GetSessionsOk returns a tuple with the Sessions field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ManageSessionsBody) GetSessionsOk() ([]string, bool) { if o == nil || IsNil(o.Sessions) { return nil, false } return o.Sessions, true } // HasSessions returns a boolean if a field has been set. func (o *ManageSessionsBody) HasSessions() bool { if o != nil && !IsNil(o.Sessions) { return true } return false } // SetSessions gets a reference to the given []string and assigns it to the Sessions field. func (o *ManageSessionsBody) SetSessions(v []string) { o.Sessions = v } func (o ManageSessionsBody) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } return json.Marshal(toSerialize) } func (o ManageSessionsBody) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["action"] = o.Action if !IsNil(o.Identities) { toSerialize["identities"] = o.Identities } if !IsNil(o.Sessions) { toSerialize["sessions"] = o.Sessions } for key, value := range o.AdditionalProperties { toSerialize[key] = value } return toSerialize, nil } func (o *ManageSessionsBody) 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{ "action", } 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) } } varManageSessionsBody := _ManageSessionsBody{} err = json.Unmarshal(data, &varManageSessionsBody) if err != nil { return err } *o = ManageSessionsBody(varManageSessionsBody) additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(data, &additionalProperties); err == nil { delete(additionalProperties, "action") delete(additionalProperties, "identities") delete(additionalProperties, "sessions") o.AdditionalProperties = additionalProperties } return err } type NullableManageSessionsBody struct { value *ManageSessionsBody isSet bool } func (v NullableManageSessionsBody) Get() *ManageSessionsBody { return v.value } func (v *NullableManageSessionsBody) Set(val *ManageSessionsBody) { v.value = val v.isSet = true } func (v NullableManageSessionsBody) IsSet() bool { return v.isSet } func (v *NullableManageSessionsBody) Unset() { v.value = nil v.isSet = false } func NewNullableManageSessionsBody(val *ManageSessionsBody) *NullableManageSessionsBody { return &NullableManageSessionsBody{value: val, isSet: true} } func (v NullableManageSessionsBody) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableManageSessionsBody) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }