Files
authentik/packages/client-go/model_token.go
T
Marc 'risson' Schmitt 2f70351c90 packages/client-go: init (#21139)
* packages/client-go: init

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>

* format

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* remove mod/sum

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* fix translate

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* no go replace

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* update rust makefile with pwd

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>

* fix build

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* fix docs

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* don't need a version ig?

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* exclude go client from cspell

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* fix main docker build

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

---------

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: Jens Langhammer <jens@goauthentik.io>
2026-03-25 15:26:50 +01:00

472 lines
12 KiB
Go
Generated

/*
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"
"time"
)
// checks if the Token type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Token{}
// Token Token Serializer
type Token struct {
Pk string `json:"pk"`
// Objects that are managed by authentik. These objects are created and updated automatically. This flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update.
Managed NullableString `json:"managed,omitempty"`
Identifier string `json:"identifier" validate:"regexp=^[-a-zA-Z0-9_]+$"`
Intent *IntentEnum `json:"intent,omitempty"`
User *int32 `json:"user,omitempty"`
UserObj User `json:"user_obj"`
Description *string `json:"description,omitempty"`
Expires NullableTime `json:"expires,omitempty"`
Expiring *bool `json:"expiring,omitempty"`
AdditionalProperties map[string]interface{}
}
type _Token Token
// NewToken instantiates a new Token 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 NewToken(pk string, identifier string, userObj User) *Token {
this := Token{}
this.Pk = pk
this.Identifier = identifier
this.UserObj = userObj
return &this
}
// NewTokenWithDefaults instantiates a new Token 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 NewTokenWithDefaults() *Token {
this := Token{}
return &this
}
// GetPk returns the Pk field value
func (o *Token) GetPk() string {
if o == nil {
var ret string
return ret
}
return o.Pk
}
// GetPkOk returns a tuple with the Pk field value
// and a boolean to check if the value has been set.
func (o *Token) GetPkOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Pk, true
}
// SetPk sets field value
func (o *Token) SetPk(v string) {
o.Pk = v
}
// GetManaged returns the Managed field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Token) GetManaged() string {
if o == nil || IsNil(o.Managed.Get()) {
var ret string
return ret
}
return *o.Managed.Get()
}
// GetManagedOk returns a tuple with the Managed 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 *Token) GetManagedOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.Managed.Get(), o.Managed.IsSet()
}
// HasManaged returns a boolean if a field has been set.
func (o *Token) HasManaged() bool {
if o != nil && o.Managed.IsSet() {
return true
}
return false
}
// SetManaged gets a reference to the given NullableString and assigns it to the Managed field.
func (o *Token) SetManaged(v string) {
o.Managed.Set(&v)
}
// SetManagedNil sets the value for Managed to be an explicit nil
func (o *Token) SetManagedNil() {
o.Managed.Set(nil)
}
// UnsetManaged ensures that no value is present for Managed, not even an explicit nil
func (o *Token) UnsetManaged() {
o.Managed.Unset()
}
// GetIdentifier returns the Identifier field value
func (o *Token) GetIdentifier() string {
if o == nil {
var ret string
return ret
}
return o.Identifier
}
// GetIdentifierOk returns a tuple with the Identifier field value
// and a boolean to check if the value has been set.
func (o *Token) GetIdentifierOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Identifier, true
}
// SetIdentifier sets field value
func (o *Token) SetIdentifier(v string) {
o.Identifier = v
}
// GetIntent returns the Intent field value if set, zero value otherwise.
func (o *Token) GetIntent() IntentEnum {
if o == nil || IsNil(o.Intent) {
var ret IntentEnum
return ret
}
return *o.Intent
}
// GetIntentOk returns a tuple with the Intent field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Token) GetIntentOk() (*IntentEnum, bool) {
if o == nil || IsNil(o.Intent) {
return nil, false
}
return o.Intent, true
}
// HasIntent returns a boolean if a field has been set.
func (o *Token) HasIntent() bool {
if o != nil && !IsNil(o.Intent) {
return true
}
return false
}
// SetIntent gets a reference to the given IntentEnum and assigns it to the Intent field.
func (o *Token) SetIntent(v IntentEnum) {
o.Intent = &v
}
// GetUser returns the User field value if set, zero value otherwise.
func (o *Token) GetUser() int32 {
if o == nil || IsNil(o.User) {
var ret int32
return ret
}
return *o.User
}
// GetUserOk returns a tuple with the User field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Token) GetUserOk() (*int32, bool) {
if o == nil || IsNil(o.User) {
return nil, false
}
return o.User, true
}
// HasUser returns a boolean if a field has been set.
func (o *Token) HasUser() bool {
if o != nil && !IsNil(o.User) {
return true
}
return false
}
// SetUser gets a reference to the given int32 and assigns it to the User field.
func (o *Token) SetUser(v int32) {
o.User = &v
}
// GetUserObj returns the UserObj field value
func (o *Token) GetUserObj() User {
if o == nil {
var ret User
return ret
}
return o.UserObj
}
// GetUserObjOk returns a tuple with the UserObj field value
// and a boolean to check if the value has been set.
func (o *Token) GetUserObjOk() (*User, bool) {
if o == nil {
return nil, false
}
return &o.UserObj, true
}
// SetUserObj sets field value
func (o *Token) SetUserObj(v User) {
o.UserObj = v
}
// GetDescription returns the Description field value if set, zero value otherwise.
func (o *Token) GetDescription() string {
if o == nil || IsNil(o.Description) {
var ret string
return ret
}
return *o.Description
}
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Token) GetDescriptionOk() (*string, bool) {
if o == nil || IsNil(o.Description) {
return nil, false
}
return o.Description, true
}
// HasDescription returns a boolean if a field has been set.
func (o *Token) HasDescription() bool {
if o != nil && !IsNil(o.Description) {
return true
}
return false
}
// SetDescription gets a reference to the given string and assigns it to the Description field.
func (o *Token) SetDescription(v string) {
o.Description = &v
}
// GetExpires returns the Expires field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Token) GetExpires() time.Time {
if o == nil || IsNil(o.Expires.Get()) {
var ret time.Time
return ret
}
return *o.Expires.Get()
}
// GetExpiresOk returns a tuple with the Expires 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 *Token) GetExpiresOk() (*time.Time, bool) {
if o == nil {
return nil, false
}
return o.Expires.Get(), o.Expires.IsSet()
}
// HasExpires returns a boolean if a field has been set.
func (o *Token) HasExpires() bool {
if o != nil && o.Expires.IsSet() {
return true
}
return false
}
// SetExpires gets a reference to the given NullableTime and assigns it to the Expires field.
func (o *Token) SetExpires(v time.Time) {
o.Expires.Set(&v)
}
// SetExpiresNil sets the value for Expires to be an explicit nil
func (o *Token) SetExpiresNil() {
o.Expires.Set(nil)
}
// UnsetExpires ensures that no value is present for Expires, not even an explicit nil
func (o *Token) UnsetExpires() {
o.Expires.Unset()
}
// GetExpiring returns the Expiring field value if set, zero value otherwise.
func (o *Token) GetExpiring() bool {
if o == nil || IsNil(o.Expiring) {
var ret bool
return ret
}
return *o.Expiring
}
// GetExpiringOk returns a tuple with the Expiring field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Token) GetExpiringOk() (*bool, bool) {
if o == nil || IsNil(o.Expiring) {
return nil, false
}
return o.Expiring, true
}
// HasExpiring returns a boolean if a field has been set.
func (o *Token) HasExpiring() bool {
if o != nil && !IsNil(o.Expiring) {
return true
}
return false
}
// SetExpiring gets a reference to the given bool and assigns it to the Expiring field.
func (o *Token) SetExpiring(v bool) {
o.Expiring = &v
}
func (o Token) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o Token) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["pk"] = o.Pk
if o.Managed.IsSet() {
toSerialize["managed"] = o.Managed.Get()
}
toSerialize["identifier"] = o.Identifier
if !IsNil(o.Intent) {
toSerialize["intent"] = o.Intent
}
if !IsNil(o.User) {
toSerialize["user"] = o.User
}
toSerialize["user_obj"] = o.UserObj
if !IsNil(o.Description) {
toSerialize["description"] = o.Description
}
if o.Expires.IsSet() {
toSerialize["expires"] = o.Expires.Get()
}
if !IsNil(o.Expiring) {
toSerialize["expiring"] = o.Expiring
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *Token) 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{
"pk",
"identifier",
"user_obj",
}
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)
}
}
varToken := _Token{}
err = json.Unmarshal(data, &varToken)
if err != nil {
return err
}
*o = Token(varToken)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "pk")
delete(additionalProperties, "managed")
delete(additionalProperties, "identifier")
delete(additionalProperties, "intent")
delete(additionalProperties, "user")
delete(additionalProperties, "user_obj")
delete(additionalProperties, "description")
delete(additionalProperties, "expires")
delete(additionalProperties, "expiring")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableToken struct {
value *Token
isSet bool
}
func (v NullableToken) Get() *Token {
return v.value
}
func (v *NullableToken) Set(val *Token) {
v.value = val
v.isSet = true
}
func (v NullableToken) IsSet() bool {
return v.isSet
}
func (v *NullableToken) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableToken(val *Token) *NullableToken {
return &NullableToken{value: val, isSet: true}
}
func (v NullableToken) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableToken) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}