228 lines
		
	
	
		
			5.4 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			228 lines
		
	
	
		
			5.4 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 UnitDTO type satisfies the MappedNullable interface at compile time
 | 
						||
var _ MappedNullable = &UnitDTO{}
 | 
						||
 | 
						||
// UnitDTO Единица измерения.
 | 
						||
type UnitDTO struct {
 | 
						||
	// Идентификатор единицы измерения.
 | 
						||
	Id int64 `json:"id"`
 | 
						||
	// Сокращенное название единицы измерения.
 | 
						||
	Name string `json:"name"`
 | 
						||
	// Полное название единицы измерения.
 | 
						||
	FullName             string `json:"fullName"`
 | 
						||
	AdditionalProperties map[string]interface{}
 | 
						||
}
 | 
						||
 | 
						||
type _UnitDTO UnitDTO
 | 
						||
 | 
						||
// NewUnitDTO instantiates a new UnitDTO 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 NewUnitDTO(id int64, name string, fullName string) *UnitDTO {
 | 
						||
	this := UnitDTO{}
 | 
						||
	this.Id = id
 | 
						||
	this.Name = name
 | 
						||
	this.FullName = fullName
 | 
						||
	return &this
 | 
						||
}
 | 
						||
 | 
						||
// NewUnitDTOWithDefaults instantiates a new UnitDTO 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 NewUnitDTOWithDefaults() *UnitDTO {
 | 
						||
	this := UnitDTO{}
 | 
						||
	return &this
 | 
						||
}
 | 
						||
 | 
						||
// GetId returns the Id field value
 | 
						||
func (o *UnitDTO) GetId() int64 {
 | 
						||
	if o == nil {
 | 
						||
		var ret int64
 | 
						||
		return ret
 | 
						||
	}
 | 
						||
 | 
						||
	return o.Id
 | 
						||
}
 | 
						||
 | 
						||
// GetIdOk returns a tuple with the Id field value
 | 
						||
// and a boolean to check if the value has been set.
 | 
						||
func (o *UnitDTO) GetIdOk() (*int64, bool) {
 | 
						||
	if o == nil {
 | 
						||
		return nil, false
 | 
						||
	}
 | 
						||
	return &o.Id, true
 | 
						||
}
 | 
						||
 | 
						||
// SetId sets field value
 | 
						||
func (o *UnitDTO) SetId(v int64) {
 | 
						||
	o.Id = v
 | 
						||
}
 | 
						||
 | 
						||
// GetName returns the Name field value
 | 
						||
func (o *UnitDTO) 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 *UnitDTO) GetNameOk() (*string, bool) {
 | 
						||
	if o == nil {
 | 
						||
		return nil, false
 | 
						||
	}
 | 
						||
	return &o.Name, true
 | 
						||
}
 | 
						||
 | 
						||
// SetName sets field value
 | 
						||
func (o *UnitDTO) SetName(v string) {
 | 
						||
	o.Name = v
 | 
						||
}
 | 
						||
 | 
						||
// GetFullName returns the FullName field value
 | 
						||
func (o *UnitDTO) GetFullName() string {
 | 
						||
	if o == nil {
 | 
						||
		var ret string
 | 
						||
		return ret
 | 
						||
	}
 | 
						||
 | 
						||
	return o.FullName
 | 
						||
}
 | 
						||
 | 
						||
// GetFullNameOk returns a tuple with the FullName field value
 | 
						||
// and a boolean to check if the value has been set.
 | 
						||
func (o *UnitDTO) GetFullNameOk() (*string, bool) {
 | 
						||
	if o == nil {
 | 
						||
		return nil, false
 | 
						||
	}
 | 
						||
	return &o.FullName, true
 | 
						||
}
 | 
						||
 | 
						||
// SetFullName sets field value
 | 
						||
func (o *UnitDTO) SetFullName(v string) {
 | 
						||
	o.FullName = v
 | 
						||
}
 | 
						||
 | 
						||
func (o UnitDTO) MarshalJSON() ([]byte, error) {
 | 
						||
	toSerialize, err := o.ToMap()
 | 
						||
	if err != nil {
 | 
						||
		return []byte{}, err
 | 
						||
	}
 | 
						||
	return json.Marshal(toSerialize)
 | 
						||
}
 | 
						||
 | 
						||
func (o UnitDTO) ToMap() (map[string]interface{}, error) {
 | 
						||
	toSerialize := map[string]interface{}{}
 | 
						||
	toSerialize["id"] = o.Id
 | 
						||
	toSerialize["name"] = o.Name
 | 
						||
	toSerialize["fullName"] = o.FullName
 | 
						||
 | 
						||
	for key, value := range o.AdditionalProperties {
 | 
						||
		toSerialize[key] = value
 | 
						||
	}
 | 
						||
 | 
						||
	return toSerialize, nil
 | 
						||
}
 | 
						||
 | 
						||
func (o *UnitDTO) 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{
 | 
						||
		"id",
 | 
						||
		"name",
 | 
						||
		"fullName",
 | 
						||
	}
 | 
						||
 | 
						||
	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)
 | 
						||
		}
 | 
						||
	}
 | 
						||
 | 
						||
	varUnitDTO := _UnitDTO{}
 | 
						||
 | 
						||
	err = json.Unmarshal(data, &varUnitDTO)
 | 
						||
 | 
						||
	if err != nil {
 | 
						||
		return err
 | 
						||
	}
 | 
						||
 | 
						||
	*o = UnitDTO(varUnitDTO)
 | 
						||
 | 
						||
	additionalProperties := make(map[string]interface{})
 | 
						||
 | 
						||
	if err = json.Unmarshal(data, &additionalProperties); err == nil {
 | 
						||
		delete(additionalProperties, "id")
 | 
						||
		delete(additionalProperties, "name")
 | 
						||
		delete(additionalProperties, "fullName")
 | 
						||
		o.AdditionalProperties = additionalProperties
 | 
						||
	}
 | 
						||
 | 
						||
	return err
 | 
						||
}
 | 
						||
 | 
						||
type NullableUnitDTO struct {
 | 
						||
	value *UnitDTO
 | 
						||
	isSet bool
 | 
						||
}
 | 
						||
 | 
						||
func (v NullableUnitDTO) Get() *UnitDTO {
 | 
						||
	return v.value
 | 
						||
}
 | 
						||
 | 
						||
func (v *NullableUnitDTO) Set(val *UnitDTO) {
 | 
						||
	v.value = val
 | 
						||
	v.isSet = true
 | 
						||
}
 | 
						||
 | 
						||
func (v NullableUnitDTO) IsSet() bool {
 | 
						||
	return v.isSet
 | 
						||
}
 | 
						||
 | 
						||
func (v *NullableUnitDTO) Unset() {
 | 
						||
	v.value = nil
 | 
						||
	v.isSet = false
 | 
						||
}
 | 
						||
 | 
						||
func NewNullableUnitDTO(val *UnitDTO) *NullableUnitDTO {
 | 
						||
	return &NullableUnitDTO{value: val, isSet: true}
 | 
						||
}
 | 
						||
 | 
						||
func (v NullableUnitDTO) MarshalJSON() ([]byte, error) {
 | 
						||
	return json.Marshal(v.value)
 | 
						||
}
 | 
						||
 | 
						||
func (v *NullableUnitDTO) UnmarshalJSON(src []byte) error {
 | 
						||
	v.isSet = true
 | 
						||
	return json.Unmarshal(src, &v.value)
 | 
						||
}
 |