Files
Sipro-Marketplaces/pkg/api/yandex/ymclient/model_token_dto.go
2025-08-15 11:10:28 +03:00

167 lines
4.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
API Яндекс Маркета для продавцов
API Яндекс Маркета помогает продавцам автоматизировать и упростить работу с маркетплейсом. В числе возможностей интеграции: * управление каталогом товаров и витриной, * обработка заказов, * изменение настроек магазина, * получение отчетов.
API version: LATEST
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package ymclient
import (
"encoding/json"
"fmt"
)
// checks if the TokenDTO type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &TokenDTO{}
// TokenDTO Информация об авторизационном токене.
type TokenDTO struct {
ApiKey ApiKeyDTO `json:"apiKey"`
AdditionalProperties map[string]interface{}
}
type _TokenDTO TokenDTO
// NewTokenDTO instantiates a new TokenDTO 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 NewTokenDTO(apiKey ApiKeyDTO) *TokenDTO {
this := TokenDTO{}
this.ApiKey = apiKey
return &this
}
// NewTokenDTOWithDefaults instantiates a new TokenDTO 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 NewTokenDTOWithDefaults() *TokenDTO {
this := TokenDTO{}
return &this
}
// GetApiKey returns the ApiKey field value
func (o *TokenDTO) GetApiKey() ApiKeyDTO {
if o == nil {
var ret ApiKeyDTO
return ret
}
return o.ApiKey
}
// GetApiKeyOk returns a tuple with the ApiKey field value
// and a boolean to check if the value has been set.
func (o *TokenDTO) GetApiKeyOk() (*ApiKeyDTO, bool) {
if o == nil {
return nil, false
}
return &o.ApiKey, true
}
// SetApiKey sets field value
func (o *TokenDTO) SetApiKey(v ApiKeyDTO) {
o.ApiKey = v
}
func (o TokenDTO) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o TokenDTO) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["apiKey"] = o.ApiKey
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *TokenDTO) 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{
"apiKey",
}
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)
}
}
varTokenDTO := _TokenDTO{}
err = json.Unmarshal(data, &varTokenDTO)
if err != nil {
return err
}
*o = TokenDTO(varTokenDTO)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "apiKey")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableTokenDTO struct {
value *TokenDTO
isSet bool
}
func (v NullableTokenDTO) Get() *TokenDTO {
return v.value
}
func (v *NullableTokenDTO) Set(val *TokenDTO) {
v.value = val
v.isSet = true
}
func (v NullableTokenDTO) IsSet() bool {
return v.isSet
}
func (v *NullableTokenDTO) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTokenDTO(val *TokenDTO) *NullableTokenDTO {
return &NullableTokenDTO{value: val, isSet: true}
}
func (v NullableTokenDTO) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTokenDTO) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}