Files
authentik/packages/client-go/model_login_source.go
T
authentik-automation[bot] ea61e1cf3b root: bump version to 2026.8.0-rc1 (#22167)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: authentik-automation[bot] <135050075+authentik-automation[bot]@users.noreply.github.com>
2026-05-08 17:15:32 +00:00

286 lines
7.0 KiB
Go
Generated

/*
authentik
Making authentication simple.
API version: 2026.8.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 LoginSource type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &LoginSource{}
// LoginSource Serializer for Login buttons of sources
type LoginSource struct {
Name string `json:"name"`
IconUrl NullableString `json:"icon_url,omitempty"`
Promoted *bool `json:"promoted,omitempty"`
Challenge LoginChallengeTypes `json:"challenge"`
AdditionalProperties map[string]interface{}
}
type _LoginSource LoginSource
// NewLoginSource instantiates a new LoginSource 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 NewLoginSource(name string, challenge LoginChallengeTypes) *LoginSource {
this := LoginSource{}
this.Name = name
var promoted bool = false
this.Promoted = &promoted
this.Challenge = challenge
return &this
}
// NewLoginSourceWithDefaults instantiates a new LoginSource 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 NewLoginSourceWithDefaults() *LoginSource {
this := LoginSource{}
var promoted bool = false
this.Promoted = &promoted
return &this
}
// GetName returns the Name field value
func (o *LoginSource) 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 *LoginSource) GetNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Name, true
}
// SetName sets field value
func (o *LoginSource) SetName(v string) {
o.Name = v
}
// GetIconUrl returns the IconUrl field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *LoginSource) GetIconUrl() string {
if o == nil || IsNil(o.IconUrl.Get()) {
var ret string
return ret
}
return *o.IconUrl.Get()
}
// GetIconUrlOk returns a tuple with the IconUrl 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 *LoginSource) GetIconUrlOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.IconUrl.Get(), o.IconUrl.IsSet()
}
// HasIconUrl returns a boolean if a field has been set.
func (o *LoginSource) HasIconUrl() bool {
if o != nil && o.IconUrl.IsSet() {
return true
}
return false
}
// SetIconUrl gets a reference to the given NullableString and assigns it to the IconUrl field.
func (o *LoginSource) SetIconUrl(v string) {
o.IconUrl.Set(&v)
}
// SetIconUrlNil sets the value for IconUrl to be an explicit nil
func (o *LoginSource) SetIconUrlNil() {
o.IconUrl.Set(nil)
}
// UnsetIconUrl ensures that no value is present for IconUrl, not even an explicit nil
func (o *LoginSource) UnsetIconUrl() {
o.IconUrl.Unset()
}
// GetPromoted returns the Promoted field value if set, zero value otherwise.
func (o *LoginSource) 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 *LoginSource) 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 *LoginSource) 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 *LoginSource) SetPromoted(v bool) {
o.Promoted = &v
}
// GetChallenge returns the Challenge field value
func (o *LoginSource) GetChallenge() LoginChallengeTypes {
if o == nil {
var ret LoginChallengeTypes
return ret
}
return o.Challenge
}
// GetChallengeOk returns a tuple with the Challenge field value
// and a boolean to check if the value has been set.
func (o *LoginSource) GetChallengeOk() (*LoginChallengeTypes, bool) {
if o == nil {
return nil, false
}
return &o.Challenge, true
}
// SetChallenge sets field value
func (o *LoginSource) SetChallenge(v LoginChallengeTypes) {
o.Challenge = v
}
func (o LoginSource) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o LoginSource) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["name"] = o.Name
if o.IconUrl.IsSet() {
toSerialize["icon_url"] = o.IconUrl.Get()
}
if !IsNil(o.Promoted) {
toSerialize["promoted"] = o.Promoted
}
toSerialize["challenge"] = o.Challenge
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *LoginSource) 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",
"challenge",
}
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)
}
}
varLoginSource := _LoginSource{}
err = json.Unmarshal(data, &varLoginSource)
if err != nil {
return err
}
*o = LoginSource(varLoginSource)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "name")
delete(additionalProperties, "icon_url")
delete(additionalProperties, "promoted")
delete(additionalProperties, "challenge")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableLoginSource struct {
value *LoginSource
isSet bool
}
func (v NullableLoginSource) Get() *LoginSource {
return v.value
}
func (v *NullableLoginSource) Set(val *LoginSource) {
v.value = val
v.isSet = true
}
func (v NullableLoginSource) IsSet() bool {
return v.isSet
}
func (v *NullableLoginSource) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableLoginSource(val *LoginSource) *NullableLoginSource {
return &NullableLoginSource{value: val, isSet: true}
}
func (v NullableLoginSource) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableLoginSource) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}