168 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			168 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
/*
 | 
						||
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 ModelsDTO type satisfies the MappedNullable interface at compile time
 | 
						||
var _ MappedNullable = &ModelsDTO{}
 | 
						||
 | 
						||
// ModelsDTO Список моделей товаров.
 | 
						||
type ModelsDTO struct {
 | 
						||
	// Список моделей товаров.
 | 
						||
	Models               []ModelDTO `json:"models"`
 | 
						||
	AdditionalProperties map[string]interface{}
 | 
						||
}
 | 
						||
 | 
						||
type _ModelsDTO ModelsDTO
 | 
						||
 | 
						||
// NewModelsDTO instantiates a new ModelsDTO 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 NewModelsDTO(models []ModelDTO) *ModelsDTO {
 | 
						||
	this := ModelsDTO{}
 | 
						||
	this.Models = models
 | 
						||
	return &this
 | 
						||
}
 | 
						||
 | 
						||
// NewModelsDTOWithDefaults instantiates a new ModelsDTO 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 NewModelsDTOWithDefaults() *ModelsDTO {
 | 
						||
	this := ModelsDTO{}
 | 
						||
	return &this
 | 
						||
}
 | 
						||
 | 
						||
// GetModels returns the Models field value
 | 
						||
func (o *ModelsDTO) GetModels() []ModelDTO {
 | 
						||
	if o == nil {
 | 
						||
		var ret []ModelDTO
 | 
						||
		return ret
 | 
						||
	}
 | 
						||
 | 
						||
	return o.Models
 | 
						||
}
 | 
						||
 | 
						||
// GetModelsOk returns a tuple with the Models field value
 | 
						||
// and a boolean to check if the value has been set.
 | 
						||
func (o *ModelsDTO) GetModelsOk() ([]ModelDTO, bool) {
 | 
						||
	if o == nil {
 | 
						||
		return nil, false
 | 
						||
	}
 | 
						||
	return o.Models, true
 | 
						||
}
 | 
						||
 | 
						||
// SetModels sets field value
 | 
						||
func (o *ModelsDTO) SetModels(v []ModelDTO) {
 | 
						||
	o.Models = v
 | 
						||
}
 | 
						||
 | 
						||
func (o ModelsDTO) MarshalJSON() ([]byte, error) {
 | 
						||
	toSerialize, err := o.ToMap()
 | 
						||
	if err != nil {
 | 
						||
		return []byte{}, err
 | 
						||
	}
 | 
						||
	return json.Marshal(toSerialize)
 | 
						||
}
 | 
						||
 | 
						||
func (o ModelsDTO) ToMap() (map[string]interface{}, error) {
 | 
						||
	toSerialize := map[string]interface{}{}
 | 
						||
	toSerialize["models"] = o.Models
 | 
						||
 | 
						||
	for key, value := range o.AdditionalProperties {
 | 
						||
		toSerialize[key] = value
 | 
						||
	}
 | 
						||
 | 
						||
	return toSerialize, nil
 | 
						||
}
 | 
						||
 | 
						||
func (o *ModelsDTO) 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{
 | 
						||
		"models",
 | 
						||
	}
 | 
						||
 | 
						||
	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)
 | 
						||
		}
 | 
						||
	}
 | 
						||
 | 
						||
	varModelsDTO := _ModelsDTO{}
 | 
						||
 | 
						||
	err = json.Unmarshal(data, &varModelsDTO)
 | 
						||
 | 
						||
	if err != nil {
 | 
						||
		return err
 | 
						||
	}
 | 
						||
 | 
						||
	*o = ModelsDTO(varModelsDTO)
 | 
						||
 | 
						||
	additionalProperties := make(map[string]interface{})
 | 
						||
 | 
						||
	if err = json.Unmarshal(data, &additionalProperties); err == nil {
 | 
						||
		delete(additionalProperties, "models")
 | 
						||
		o.AdditionalProperties = additionalProperties
 | 
						||
	}
 | 
						||
 | 
						||
	return err
 | 
						||
}
 | 
						||
 | 
						||
type NullableModelsDTO struct {
 | 
						||
	value *ModelsDTO
 | 
						||
	isSet bool
 | 
						||
}
 | 
						||
 | 
						||
func (v NullableModelsDTO) Get() *ModelsDTO {
 | 
						||
	return v.value
 | 
						||
}
 | 
						||
 | 
						||
func (v *NullableModelsDTO) Set(val *ModelsDTO) {
 | 
						||
	v.value = val
 | 
						||
	v.isSet = true
 | 
						||
}
 | 
						||
 | 
						||
func (v NullableModelsDTO) IsSet() bool {
 | 
						||
	return v.isSet
 | 
						||
}
 | 
						||
 | 
						||
func (v *NullableModelsDTO) Unset() {
 | 
						||
	v.value = nil
 | 
						||
	v.isSet = false
 | 
						||
}
 | 
						||
 | 
						||
func NewNullableModelsDTO(val *ModelsDTO) *NullableModelsDTO {
 | 
						||
	return &NullableModelsDTO{value: val, isSet: true}
 | 
						||
}
 | 
						||
 | 
						||
func (v NullableModelsDTO) MarshalJSON() ([]byte, error) {
 | 
						||
	return json.Marshal(v.value)
 | 
						||
}
 | 
						||
 | 
						||
func (v *NullableModelsDTO) UnmarshalJSON(src []byte) error {
 | 
						||
	v.isSet = true
 | 
						||
	return json.Unmarshal(src, &v.value)
 | 
						||
}
 |