Files
portal/openapi/model_token.go
2026-06-22 11:38:29 +02:00

187 lines
4.1 KiB
Go

/*
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 Token type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Token{}
// Token struct for Token
type Token struct {
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
}
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(accessToken string, tokenType string) *Token {
this := Token{}
this.AccessToken = accessToken
this.TokenType = tokenType
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
}
// GetAccessToken returns the AccessToken field value
func (o *Token) GetAccessToken() string {
if o == nil {
var ret string
return ret
}
return o.AccessToken
}
// GetAccessTokenOk returns a tuple with the AccessToken field value
// and a boolean to check if the value has been set.
func (o *Token) GetAccessTokenOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.AccessToken, true
}
// SetAccessToken sets field value
func (o *Token) SetAccessToken(v string) {
o.AccessToken = v
}
// GetTokenType returns the TokenType field value
func (o *Token) GetTokenType() string {
if o == nil {
var ret string
return ret
}
return o.TokenType
}
// GetTokenTypeOk returns a tuple with the TokenType field value
// and a boolean to check if the value has been set.
func (o *Token) GetTokenTypeOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.TokenType, true
}
// SetTokenType sets field value
func (o *Token) SetTokenType(v string) {
o.TokenType = 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["access_token"] = o.AccessToken
toSerialize["token_type"] = o.TokenType
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{
"access_token",
"token_type",
}
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{}
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
err = decoder.Decode(&varToken)
if err != nil {
return err
}
*o = Token(varToken)
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)
}