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

303 lines
7.4 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 RegionDTO type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &RegionDTO{}
// RegionDTO Регион доставки.
type RegionDTO struct {
// Идентификатор региона.
Id int64 `json:"id"`
// Название региона.
Name string `json:"name"`
Type RegionType `json:"type"`
Parent *RegionDTO `json:"parent,omitempty"`
// Дочерние регионы.
Children []RegionDTO `json:"children,omitempty"`
AdditionalProperties map[string]interface{}
}
type _RegionDTO RegionDTO
// NewRegionDTO instantiates a new RegionDTO 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 NewRegionDTO(id int64, name string, type_ RegionType) *RegionDTO {
this := RegionDTO{}
this.Id = id
this.Name = name
this.Type = type_
return &this
}
// NewRegionDTOWithDefaults instantiates a new RegionDTO 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 NewRegionDTOWithDefaults() *RegionDTO {
this := RegionDTO{}
return &this
}
// GetId returns the Id field value
func (o *RegionDTO) 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 *RegionDTO) GetIdOk() (*int64, bool) {
if o == nil {
return nil, false
}
return &o.Id, true
}
// SetId sets field value
func (o *RegionDTO) SetId(v int64) {
o.Id = v
}
// GetName returns the Name field value
func (o *RegionDTO) 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 *RegionDTO) GetNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Name, true
}
// SetName sets field value
func (o *RegionDTO) SetName(v string) {
o.Name = v
}
// GetType returns the Type field value
func (o *RegionDTO) GetType() RegionType {
if o == nil {
var ret RegionType
return ret
}
return o.Type
}
// GetTypeOk returns a tuple with the Type field value
// and a boolean to check if the value has been set.
func (o *RegionDTO) GetTypeOk() (*RegionType, bool) {
if o == nil {
return nil, false
}
return &o.Type, true
}
// SetType sets field value
func (o *RegionDTO) SetType(v RegionType) {
o.Type = v
}
// GetParent returns the Parent field value if set, zero value otherwise.
func (o *RegionDTO) GetParent() RegionDTO {
if o == nil || IsNil(o.Parent) {
var ret RegionDTO
return ret
}
return *o.Parent
}
// GetParentOk returns a tuple with the Parent field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *RegionDTO) GetParentOk() (*RegionDTO, bool) {
if o == nil || IsNil(o.Parent) {
return nil, false
}
return o.Parent, true
}
// HasParent returns a boolean if a field has been set.
func (o *RegionDTO) HasParent() bool {
if o != nil && !IsNil(o.Parent) {
return true
}
return false
}
// SetParent gets a reference to the given RegionDTO and assigns it to the Parent field.
func (o *RegionDTO) SetParent(v RegionDTO) {
o.Parent = &v
}
// GetChildren returns the Children field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *RegionDTO) GetChildren() []RegionDTO {
if o == nil {
var ret []RegionDTO
return ret
}
return o.Children
}
// GetChildrenOk returns a tuple with the Children 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 *RegionDTO) GetChildrenOk() ([]RegionDTO, bool) {
if o == nil || IsNil(o.Children) {
return nil, false
}
return o.Children, true
}
// HasChildren returns a boolean if a field has been set.
func (o *RegionDTO) HasChildren() bool {
if o != nil && !IsNil(o.Children) {
return true
}
return false
}
// SetChildren gets a reference to the given []RegionDTO and assigns it to the Children field.
func (o *RegionDTO) SetChildren(v []RegionDTO) {
o.Children = v
}
func (o RegionDTO) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o RegionDTO) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["id"] = o.Id
toSerialize["name"] = o.Name
toSerialize["type"] = o.Type
if !IsNil(o.Parent) {
toSerialize["parent"] = o.Parent
}
if o.Children != nil {
toSerialize["children"] = o.Children
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *RegionDTO) 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",
"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)
}
}
varRegionDTO := _RegionDTO{}
err = json.Unmarshal(data, &varRegionDTO)
if err != nil {
return err
}
*o = RegionDTO(varRegionDTO)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "id")
delete(additionalProperties, "name")
delete(additionalProperties, "type")
delete(additionalProperties, "parent")
delete(additionalProperties, "children")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableRegionDTO struct {
value *RegionDTO
isSet bool
}
func (v NullableRegionDTO) Get() *RegionDTO {
return v.value
}
func (v *NullableRegionDTO) Set(val *RegionDTO) {
v.value = val
v.isSet = true
}
func (v NullableRegionDTO) IsSet() bool {
return v.isSet
}
func (v *NullableRegionDTO) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableRegionDTO(val *RegionDTO) *NullableRegionDTO {
return &NullableRegionDTO{value: val, isSet: true}
}
func (v NullableRegionDTO) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableRegionDTO) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}