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

205 lines
5.7 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 TurnoverDTO type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &TurnoverDTO{}
// TurnoverDTO Информация об оборачиваемости товара. Подробнее о хранении и оборачиваемости товаров читайте в [Справке Маркета для продавцов](https://yandex.ru/support/marketplace/ru/storage/logistics#turnover).
type TurnoverDTO struct {
Turnover TurnoverType `json:"turnover"`
// Значение в днях.
TurnoverDays *float64 `json:"turnoverDays,omitempty"`
AdditionalProperties map[string]interface{}
}
type _TurnoverDTO TurnoverDTO
// NewTurnoverDTO instantiates a new TurnoverDTO 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 NewTurnoverDTO(turnover TurnoverType) *TurnoverDTO {
this := TurnoverDTO{}
this.Turnover = turnover
return &this
}
// NewTurnoverDTOWithDefaults instantiates a new TurnoverDTO 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 NewTurnoverDTOWithDefaults() *TurnoverDTO {
this := TurnoverDTO{}
return &this
}
// GetTurnover returns the Turnover field value
func (o *TurnoverDTO) GetTurnover() TurnoverType {
if o == nil {
var ret TurnoverType
return ret
}
return o.Turnover
}
// GetTurnoverOk returns a tuple with the Turnover field value
// and a boolean to check if the value has been set.
func (o *TurnoverDTO) GetTurnoverOk() (*TurnoverType, bool) {
if o == nil {
return nil, false
}
return &o.Turnover, true
}
// SetTurnover sets field value
func (o *TurnoverDTO) SetTurnover(v TurnoverType) {
o.Turnover = v
}
// GetTurnoverDays returns the TurnoverDays field value if set, zero value otherwise.
func (o *TurnoverDTO) GetTurnoverDays() float64 {
if o == nil || IsNil(o.TurnoverDays) {
var ret float64
return ret
}
return *o.TurnoverDays
}
// GetTurnoverDaysOk returns a tuple with the TurnoverDays field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TurnoverDTO) GetTurnoverDaysOk() (*float64, bool) {
if o == nil || IsNil(o.TurnoverDays) {
return nil, false
}
return o.TurnoverDays, true
}
// HasTurnoverDays returns a boolean if a field has been set.
func (o *TurnoverDTO) HasTurnoverDays() bool {
if o != nil && !IsNil(o.TurnoverDays) {
return true
}
return false
}
// SetTurnoverDays gets a reference to the given float64 and assigns it to the TurnoverDays field.
func (o *TurnoverDTO) SetTurnoverDays(v float64) {
o.TurnoverDays = &v
}
func (o TurnoverDTO) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o TurnoverDTO) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["turnover"] = o.Turnover
if !IsNil(o.TurnoverDays) {
toSerialize["turnoverDays"] = o.TurnoverDays
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *TurnoverDTO) 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{
"turnover",
}
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)
}
}
varTurnoverDTO := _TurnoverDTO{}
err = json.Unmarshal(data, &varTurnoverDTO)
if err != nil {
return err
}
*o = TurnoverDTO(varTurnoverDTO)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "turnover")
delete(additionalProperties, "turnoverDays")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableTurnoverDTO struct {
value *TurnoverDTO
isSet bool
}
func (v NullableTurnoverDTO) Get() *TurnoverDTO {
return v.value
}
func (v *NullableTurnoverDTO) Set(val *TurnoverDTO) {
v.value = val
v.isSet = true
}
func (v NullableTurnoverDTO) IsSet() bool {
return v.isSet
}
func (v *NullableTurnoverDTO) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTurnoverDTO(val *TurnoverDTO) *NullableTurnoverDTO {
return &NullableTurnoverDTO{value: val, isSet: true}
}
func (v NullableTurnoverDTO) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTurnoverDTO) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}