feat: shit shit
This commit is contained in:
196
pkg/api/yandex/ymclient/model_country_dto.go
Normal file
196
pkg/api/yandex/ymclient/model_country_dto.go
Normal file
@@ -0,0 +1,196 @@
|
||||
/*
|
||||
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 CountryDTO type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &CountryDTO{}
|
||||
|
||||
// CountryDTO Страна и ее код в формате :no-translate[ISO 3166-1 alpha-2].
|
||||
type CountryDTO struct {
|
||||
Region RegionDTO `json:"region"`
|
||||
// Страна производства в формате ISO 3166-1 alpha-2. [Как получить](../../reference/regions/getRegionsCodes.md)
|
||||
CountryCode string `json:"countryCode" validate:"regexp=^[A-Z]{2}$"`
|
||||
AdditionalProperties map[string]interface{}
|
||||
}
|
||||
|
||||
type _CountryDTO CountryDTO
|
||||
|
||||
// NewCountryDTO instantiates a new CountryDTO 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 NewCountryDTO(region RegionDTO, countryCode string) *CountryDTO {
|
||||
this := CountryDTO{}
|
||||
this.Region = region
|
||||
this.CountryCode = countryCode
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewCountryDTOWithDefaults instantiates a new CountryDTO 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 NewCountryDTOWithDefaults() *CountryDTO {
|
||||
this := CountryDTO{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetRegion returns the Region field value
|
||||
func (o *CountryDTO) GetRegion() RegionDTO {
|
||||
if o == nil {
|
||||
var ret RegionDTO
|
||||
return ret
|
||||
}
|
||||
|
||||
return o.Region
|
||||
}
|
||||
|
||||
// GetRegionOk returns a tuple with the Region field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CountryDTO) GetRegionOk() (*RegionDTO, bool) {
|
||||
if o == nil {
|
||||
return nil, false
|
||||
}
|
||||
return &o.Region, true
|
||||
}
|
||||
|
||||
// SetRegion sets field value
|
||||
func (o *CountryDTO) SetRegion(v RegionDTO) {
|
||||
o.Region = v
|
||||
}
|
||||
|
||||
// GetCountryCode returns the CountryCode field value
|
||||
func (o *CountryDTO) GetCountryCode() string {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
|
||||
return o.CountryCode
|
||||
}
|
||||
|
||||
// GetCountryCodeOk returns a tuple with the CountryCode field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CountryDTO) GetCountryCodeOk() (*string, bool) {
|
||||
if o == nil {
|
||||
return nil, false
|
||||
}
|
||||
return &o.CountryCode, true
|
||||
}
|
||||
|
||||
// SetCountryCode sets field value
|
||||
func (o *CountryDTO) SetCountryCode(v string) {
|
||||
o.CountryCode = v
|
||||
}
|
||||
|
||||
func (o CountryDTO) MarshalJSON() ([]byte, error) {
|
||||
toSerialize, err := o.ToMap()
|
||||
if err != nil {
|
||||
return []byte{}, err
|
||||
}
|
||||
return json.Marshal(toSerialize)
|
||||
}
|
||||
|
||||
func (o CountryDTO) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
toSerialize["region"] = o.Region
|
||||
toSerialize["countryCode"] = o.CountryCode
|
||||
|
||||
for key, value := range o.AdditionalProperties {
|
||||
toSerialize[key] = value
|
||||
}
|
||||
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
func (o *CountryDTO) 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{
|
||||
"region",
|
||||
"countryCode",
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
varCountryDTO := _CountryDTO{}
|
||||
|
||||
err = json.Unmarshal(data, &varCountryDTO)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = CountryDTO(varCountryDTO)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(data, &additionalProperties); err == nil {
|
||||
delete(additionalProperties, "region")
|
||||
delete(additionalProperties, "countryCode")
|
||||
o.AdditionalProperties = additionalProperties
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
type NullableCountryDTO struct {
|
||||
value *CountryDTO
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableCountryDTO) Get() *CountryDTO {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableCountryDTO) Set(val *CountryDTO) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableCountryDTO) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableCountryDTO) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableCountryDTO(val *CountryDTO) *NullableCountryDTO {
|
||||
return &NullableCountryDTO{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableCountryDTO) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableCountryDTO) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
Reference in New Issue
Block a user