/* 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 PlexSourceRequest type satisfies the MappedNullable interface at compile time var _ MappedNullable = &PlexSourceRequest{} // PlexSourceRequest Plex Source Serializer type PlexSourceRequest struct { // Source's display Name. Name string `json:"name"` // Internal source name, used in URLs. Slug string `json:"slug" validate:"regexp=^[-a-zA-Z0-9_]+$"` Enabled *bool `json:"enabled,omitempty"` // When enabled, this source will be displayed as a prominent button on the login page, instead of a small icon. Promoted *bool `json:"promoted,omitempty"` // Flow to use when authenticating existing users. AuthenticationFlow NullableString `json:"authentication_flow,omitempty"` // Flow to use when enrolling new users. EnrollmentFlow NullableString `json:"enrollment_flow,omitempty"` UserPropertyMappings []string `json:"user_property_mappings,omitempty"` GroupPropertyMappings []string `json:"group_property_mappings,omitempty"` PolicyEngineMode *PolicyEngineMode `json:"policy_engine_mode,omitempty"` // How the source determines if an existing user should be authenticated or a new user enrolled. UserMatchingMode *UserMatchingModeEnum `json:"user_matching_mode,omitempty"` UserPathTemplate *string `json:"user_path_template,omitempty"` Icon *string `json:"icon,omitempty"` // How the source determines if an existing group should be used or a new group created. GroupMatchingMode *GroupMatchingModeEnum `json:"group_matching_mode,omitempty"` // Client identifier used to talk to Plex. ClientId *string `json:"client_id,omitempty"` // Which servers a user has to be a member of to be granted access. Empty list allows every server. AllowedServers []string `json:"allowed_servers,omitempty"` // Allow friends to authenticate, even if you don't share a server. AllowFriends *bool `json:"allow_friends,omitempty"` // Plex token used to check friends PlexToken string `json:"plex_token"` AdditionalProperties map[string]interface{} } type _PlexSourceRequest PlexSourceRequest // NewPlexSourceRequest instantiates a new PlexSourceRequest 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 NewPlexSourceRequest(name string, slug string, plexToken string) *PlexSourceRequest { this := PlexSourceRequest{} this.Name = name this.Slug = slug this.PlexToken = plexToken return &this } // NewPlexSourceRequestWithDefaults instantiates a new PlexSourceRequest 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 NewPlexSourceRequestWithDefaults() *PlexSourceRequest { this := PlexSourceRequest{} return &this } // GetName returns the Name field value func (o *PlexSourceRequest) 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 *PlexSourceRequest) GetNameOk() (*string, bool) { if o == nil { return nil, false } return &o.Name, true } // SetName sets field value func (o *PlexSourceRequest) SetName(v string) { o.Name = v } // GetSlug returns the Slug field value func (o *PlexSourceRequest) GetSlug() string { if o == nil { var ret string return ret } return o.Slug } // GetSlugOk returns a tuple with the Slug field value // and a boolean to check if the value has been set. func (o *PlexSourceRequest) GetSlugOk() (*string, bool) { if o == nil { return nil, false } return &o.Slug, true } // SetSlug sets field value func (o *PlexSourceRequest) SetSlug(v string) { o.Slug = v } // GetEnabled returns the Enabled field value if set, zero value otherwise. func (o *PlexSourceRequest) GetEnabled() bool { if o == nil || IsNil(o.Enabled) { var ret bool return ret } return *o.Enabled } // GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *PlexSourceRequest) GetEnabledOk() (*bool, bool) { if o == nil || IsNil(o.Enabled) { return nil, false } return o.Enabled, true } // HasEnabled returns a boolean if a field has been set. func (o *PlexSourceRequest) HasEnabled() bool { if o != nil && !IsNil(o.Enabled) { return true } return false } // SetEnabled gets a reference to the given bool and assigns it to the Enabled field. func (o *PlexSourceRequest) SetEnabled(v bool) { o.Enabled = &v } // GetPromoted returns the Promoted field value if set, zero value otherwise. func (o *PlexSourceRequest) GetPromoted() bool { if o == nil || IsNil(o.Promoted) { var ret bool return ret } return *o.Promoted } // GetPromotedOk returns a tuple with the Promoted field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *PlexSourceRequest) GetPromotedOk() (*bool, bool) { if o == nil || IsNil(o.Promoted) { return nil, false } return o.Promoted, true } // HasPromoted returns a boolean if a field has been set. func (o *PlexSourceRequest) HasPromoted() bool { if o != nil && !IsNil(o.Promoted) { return true } return false } // SetPromoted gets a reference to the given bool and assigns it to the Promoted field. func (o *PlexSourceRequest) SetPromoted(v bool) { o.Promoted = &v } // GetAuthenticationFlow returns the AuthenticationFlow field value if set, zero value otherwise (both if not set or set to explicit null). func (o *PlexSourceRequest) GetAuthenticationFlow() string { if o == nil || IsNil(o.AuthenticationFlow.Get()) { var ret string return ret } return *o.AuthenticationFlow.Get() } // GetAuthenticationFlowOk returns a tuple with the AuthenticationFlow 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 *PlexSourceRequest) GetAuthenticationFlowOk() (*string, bool) { if o == nil { return nil, false } return o.AuthenticationFlow.Get(), o.AuthenticationFlow.IsSet() } // HasAuthenticationFlow returns a boolean if a field has been set. func (o *PlexSourceRequest) HasAuthenticationFlow() bool { if o != nil && o.AuthenticationFlow.IsSet() { return true } return false } // SetAuthenticationFlow gets a reference to the given NullableString and assigns it to the AuthenticationFlow field. func (o *PlexSourceRequest) SetAuthenticationFlow(v string) { o.AuthenticationFlow.Set(&v) } // SetAuthenticationFlowNil sets the value for AuthenticationFlow to be an explicit nil func (o *PlexSourceRequest) SetAuthenticationFlowNil() { o.AuthenticationFlow.Set(nil) } // UnsetAuthenticationFlow ensures that no value is present for AuthenticationFlow, not even an explicit nil func (o *PlexSourceRequest) UnsetAuthenticationFlow() { o.AuthenticationFlow.Unset() } // GetEnrollmentFlow returns the EnrollmentFlow field value if set, zero value otherwise (both if not set or set to explicit null). func (o *PlexSourceRequest) GetEnrollmentFlow() string { if o == nil || IsNil(o.EnrollmentFlow.Get()) { var ret string return ret } return *o.EnrollmentFlow.Get() } // GetEnrollmentFlowOk returns a tuple with the EnrollmentFlow 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 *PlexSourceRequest) GetEnrollmentFlowOk() (*string, bool) { if o == nil { return nil, false } return o.EnrollmentFlow.Get(), o.EnrollmentFlow.IsSet() } // HasEnrollmentFlow returns a boolean if a field has been set. func (o *PlexSourceRequest) HasEnrollmentFlow() bool { if o != nil && o.EnrollmentFlow.IsSet() { return true } return false } // SetEnrollmentFlow gets a reference to the given NullableString and assigns it to the EnrollmentFlow field. func (o *PlexSourceRequest) SetEnrollmentFlow(v string) { o.EnrollmentFlow.Set(&v) } // SetEnrollmentFlowNil sets the value for EnrollmentFlow to be an explicit nil func (o *PlexSourceRequest) SetEnrollmentFlowNil() { o.EnrollmentFlow.Set(nil) } // UnsetEnrollmentFlow ensures that no value is present for EnrollmentFlow, not even an explicit nil func (o *PlexSourceRequest) UnsetEnrollmentFlow() { o.EnrollmentFlow.Unset() } // GetUserPropertyMappings returns the UserPropertyMappings field value if set, zero value otherwise. func (o *PlexSourceRequest) GetUserPropertyMappings() []string { if o == nil || IsNil(o.UserPropertyMappings) { var ret []string return ret } return o.UserPropertyMappings } // GetUserPropertyMappingsOk returns a tuple with the UserPropertyMappings field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *PlexSourceRequest) GetUserPropertyMappingsOk() ([]string, bool) { if o == nil || IsNil(o.UserPropertyMappings) { return nil, false } return o.UserPropertyMappings, true } // HasUserPropertyMappings returns a boolean if a field has been set. func (o *PlexSourceRequest) HasUserPropertyMappings() bool { if o != nil && !IsNil(o.UserPropertyMappings) { return true } return false } // SetUserPropertyMappings gets a reference to the given []string and assigns it to the UserPropertyMappings field. func (o *PlexSourceRequest) SetUserPropertyMappings(v []string) { o.UserPropertyMappings = v } // GetGroupPropertyMappings returns the GroupPropertyMappings field value if set, zero value otherwise. func (o *PlexSourceRequest) GetGroupPropertyMappings() []string { if o == nil || IsNil(o.GroupPropertyMappings) { var ret []string return ret } return o.GroupPropertyMappings } // GetGroupPropertyMappingsOk returns a tuple with the GroupPropertyMappings field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *PlexSourceRequest) GetGroupPropertyMappingsOk() ([]string, bool) { if o == nil || IsNil(o.GroupPropertyMappings) { return nil, false } return o.GroupPropertyMappings, true } // HasGroupPropertyMappings returns a boolean if a field has been set. func (o *PlexSourceRequest) HasGroupPropertyMappings() bool { if o != nil && !IsNil(o.GroupPropertyMappings) { return true } return false } // SetGroupPropertyMappings gets a reference to the given []string and assigns it to the GroupPropertyMappings field. func (o *PlexSourceRequest) SetGroupPropertyMappings(v []string) { o.GroupPropertyMappings = v } // GetPolicyEngineMode returns the PolicyEngineMode field value if set, zero value otherwise. func (o *PlexSourceRequest) GetPolicyEngineMode() PolicyEngineMode { if o == nil || IsNil(o.PolicyEngineMode) { var ret PolicyEngineMode return ret } return *o.PolicyEngineMode } // GetPolicyEngineModeOk returns a tuple with the PolicyEngineMode field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *PlexSourceRequest) GetPolicyEngineModeOk() (*PolicyEngineMode, bool) { if o == nil || IsNil(o.PolicyEngineMode) { return nil, false } return o.PolicyEngineMode, true } // HasPolicyEngineMode returns a boolean if a field has been set. func (o *PlexSourceRequest) HasPolicyEngineMode() bool { if o != nil && !IsNil(o.PolicyEngineMode) { return true } return false } // SetPolicyEngineMode gets a reference to the given PolicyEngineMode and assigns it to the PolicyEngineMode field. func (o *PlexSourceRequest) SetPolicyEngineMode(v PolicyEngineMode) { o.PolicyEngineMode = &v } // GetUserMatchingMode returns the UserMatchingMode field value if set, zero value otherwise. func (o *PlexSourceRequest) GetUserMatchingMode() UserMatchingModeEnum { if o == nil || IsNil(o.UserMatchingMode) { var ret UserMatchingModeEnum return ret } return *o.UserMatchingMode } // GetUserMatchingModeOk returns a tuple with the UserMatchingMode field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *PlexSourceRequest) GetUserMatchingModeOk() (*UserMatchingModeEnum, bool) { if o == nil || IsNil(o.UserMatchingMode) { return nil, false } return o.UserMatchingMode, true } // HasUserMatchingMode returns a boolean if a field has been set. func (o *PlexSourceRequest) HasUserMatchingMode() bool { if o != nil && !IsNil(o.UserMatchingMode) { return true } return false } // SetUserMatchingMode gets a reference to the given UserMatchingModeEnum and assigns it to the UserMatchingMode field. func (o *PlexSourceRequest) SetUserMatchingMode(v UserMatchingModeEnum) { o.UserMatchingMode = &v } // GetUserPathTemplate returns the UserPathTemplate field value if set, zero value otherwise. func (o *PlexSourceRequest) GetUserPathTemplate() string { if o == nil || IsNil(o.UserPathTemplate) { var ret string return ret } return *o.UserPathTemplate } // GetUserPathTemplateOk returns a tuple with the UserPathTemplate field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *PlexSourceRequest) GetUserPathTemplateOk() (*string, bool) { if o == nil || IsNil(o.UserPathTemplate) { return nil, false } return o.UserPathTemplate, true } // HasUserPathTemplate returns a boolean if a field has been set. func (o *PlexSourceRequest) HasUserPathTemplate() bool { if o != nil && !IsNil(o.UserPathTemplate) { return true } return false } // SetUserPathTemplate gets a reference to the given string and assigns it to the UserPathTemplate field. func (o *PlexSourceRequest) SetUserPathTemplate(v string) { o.UserPathTemplate = &v } // GetIcon returns the Icon field value if set, zero value otherwise. func (o *PlexSourceRequest) GetIcon() string { if o == nil || IsNil(o.Icon) { var ret string return ret } return *o.Icon } // GetIconOk returns a tuple with the Icon field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *PlexSourceRequest) GetIconOk() (*string, bool) { if o == nil || IsNil(o.Icon) { return nil, false } return o.Icon, true } // HasIcon returns a boolean if a field has been set. func (o *PlexSourceRequest) HasIcon() bool { if o != nil && !IsNil(o.Icon) { return true } return false } // SetIcon gets a reference to the given string and assigns it to the Icon field. func (o *PlexSourceRequest) SetIcon(v string) { o.Icon = &v } // GetGroupMatchingMode returns the GroupMatchingMode field value if set, zero value otherwise. func (o *PlexSourceRequest) GetGroupMatchingMode() GroupMatchingModeEnum { if o == nil || IsNil(o.GroupMatchingMode) { var ret GroupMatchingModeEnum return ret } return *o.GroupMatchingMode } // GetGroupMatchingModeOk returns a tuple with the GroupMatchingMode field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *PlexSourceRequest) GetGroupMatchingModeOk() (*GroupMatchingModeEnum, bool) { if o == nil || IsNil(o.GroupMatchingMode) { return nil, false } return o.GroupMatchingMode, true } // HasGroupMatchingMode returns a boolean if a field has been set. func (o *PlexSourceRequest) HasGroupMatchingMode() bool { if o != nil && !IsNil(o.GroupMatchingMode) { return true } return false } // SetGroupMatchingMode gets a reference to the given GroupMatchingModeEnum and assigns it to the GroupMatchingMode field. func (o *PlexSourceRequest) SetGroupMatchingMode(v GroupMatchingModeEnum) { o.GroupMatchingMode = &v } // GetClientId returns the ClientId field value if set, zero value otherwise. func (o *PlexSourceRequest) GetClientId() string { if o == nil || IsNil(o.ClientId) { var ret string return ret } return *o.ClientId } // GetClientIdOk returns a tuple with the ClientId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *PlexSourceRequest) GetClientIdOk() (*string, bool) { if o == nil || IsNil(o.ClientId) { return nil, false } return o.ClientId, true } // HasClientId returns a boolean if a field has been set. func (o *PlexSourceRequest) HasClientId() bool { if o != nil && !IsNil(o.ClientId) { return true } return false } // SetClientId gets a reference to the given string and assigns it to the ClientId field. func (o *PlexSourceRequest) SetClientId(v string) { o.ClientId = &v } // GetAllowedServers returns the AllowedServers field value if set, zero value otherwise. func (o *PlexSourceRequest) GetAllowedServers() []string { if o == nil || IsNil(o.AllowedServers) { var ret []string return ret } return o.AllowedServers } // GetAllowedServersOk returns a tuple with the AllowedServers field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *PlexSourceRequest) GetAllowedServersOk() ([]string, bool) { if o == nil || IsNil(o.AllowedServers) { return nil, false } return o.AllowedServers, true } // HasAllowedServers returns a boolean if a field has been set. func (o *PlexSourceRequest) HasAllowedServers() bool { if o != nil && !IsNil(o.AllowedServers) { return true } return false } // SetAllowedServers gets a reference to the given []string and assigns it to the AllowedServers field. func (o *PlexSourceRequest) SetAllowedServers(v []string) { o.AllowedServers = v } // GetAllowFriends returns the AllowFriends field value if set, zero value otherwise. func (o *PlexSourceRequest) GetAllowFriends() bool { if o == nil || IsNil(o.AllowFriends) { var ret bool return ret } return *o.AllowFriends } // GetAllowFriendsOk returns a tuple with the AllowFriends field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *PlexSourceRequest) GetAllowFriendsOk() (*bool, bool) { if o == nil || IsNil(o.AllowFriends) { return nil, false } return o.AllowFriends, true } // HasAllowFriends returns a boolean if a field has been set. func (o *PlexSourceRequest) HasAllowFriends() bool { if o != nil && !IsNil(o.AllowFriends) { return true } return false } // SetAllowFriends gets a reference to the given bool and assigns it to the AllowFriends field. func (o *PlexSourceRequest) SetAllowFriends(v bool) { o.AllowFriends = &v } // GetPlexToken returns the PlexToken field value func (o *PlexSourceRequest) GetPlexToken() string { if o == nil { var ret string return ret } return o.PlexToken } // GetPlexTokenOk returns a tuple with the PlexToken field value // and a boolean to check if the value has been set. func (o *PlexSourceRequest) GetPlexTokenOk() (*string, bool) { if o == nil { return nil, false } return &o.PlexToken, true } // SetPlexToken sets field value func (o *PlexSourceRequest) SetPlexToken(v string) { o.PlexToken = v } func (o PlexSourceRequest) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } return json.Marshal(toSerialize) } func (o PlexSourceRequest) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["name"] = o.Name toSerialize["slug"] = o.Slug if !IsNil(o.Enabled) { toSerialize["enabled"] = o.Enabled } if !IsNil(o.Promoted) { toSerialize["promoted"] = o.Promoted } if o.AuthenticationFlow.IsSet() { toSerialize["authentication_flow"] = o.AuthenticationFlow.Get() } if o.EnrollmentFlow.IsSet() { toSerialize["enrollment_flow"] = o.EnrollmentFlow.Get() } if !IsNil(o.UserPropertyMappings) { toSerialize["user_property_mappings"] = o.UserPropertyMappings } if !IsNil(o.GroupPropertyMappings) { toSerialize["group_property_mappings"] = o.GroupPropertyMappings } if !IsNil(o.PolicyEngineMode) { toSerialize["policy_engine_mode"] = o.PolicyEngineMode } if !IsNil(o.UserMatchingMode) { toSerialize["user_matching_mode"] = o.UserMatchingMode } if !IsNil(o.UserPathTemplate) { toSerialize["user_path_template"] = o.UserPathTemplate } if !IsNil(o.Icon) { toSerialize["icon"] = o.Icon } if !IsNil(o.GroupMatchingMode) { toSerialize["group_matching_mode"] = o.GroupMatchingMode } if !IsNil(o.ClientId) { toSerialize["client_id"] = o.ClientId } if !IsNil(o.AllowedServers) { toSerialize["allowed_servers"] = o.AllowedServers } if !IsNil(o.AllowFriends) { toSerialize["allow_friends"] = o.AllowFriends } toSerialize["plex_token"] = o.PlexToken for key, value := range o.AdditionalProperties { toSerialize[key] = value } return toSerialize, nil } func (o *PlexSourceRequest) 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", "slug", "plex_token", } 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) } } varPlexSourceRequest := _PlexSourceRequest{} err = json.Unmarshal(data, &varPlexSourceRequest) if err != nil { return err } *o = PlexSourceRequest(varPlexSourceRequest) additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(data, &additionalProperties); err == nil { delete(additionalProperties, "name") delete(additionalProperties, "slug") delete(additionalProperties, "enabled") delete(additionalProperties, "promoted") delete(additionalProperties, "authentication_flow") delete(additionalProperties, "enrollment_flow") delete(additionalProperties, "user_property_mappings") delete(additionalProperties, "group_property_mappings") delete(additionalProperties, "policy_engine_mode") delete(additionalProperties, "user_matching_mode") delete(additionalProperties, "user_path_template") delete(additionalProperties, "icon") delete(additionalProperties, "group_matching_mode") delete(additionalProperties, "client_id") delete(additionalProperties, "allowed_servers") delete(additionalProperties, "allow_friends") delete(additionalProperties, "plex_token") o.AdditionalProperties = additionalProperties } return err } type NullablePlexSourceRequest struct { value *PlexSourceRequest isSet bool } func (v NullablePlexSourceRequest) Get() *PlexSourceRequest { return v.value } func (v *NullablePlexSourceRequest) Set(val *PlexSourceRequest) { v.value = val v.isSet = true } func (v NullablePlexSourceRequest) IsSet() bool { return v.isSet } func (v *NullablePlexSourceRequest) Unset() { v.value = nil v.isSet = false } func NewNullablePlexSourceRequest(val *PlexSourceRequest) *NullablePlexSourceRequest { return &NullablePlexSourceRequest{value: val, isSet: true} } func (v NullablePlexSourceRequest) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullablePlexSourceRequest) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }