Files
sdk/model_cart_item_set.go

269 lines
7.0 KiB
Go

/*
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
API version: v1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hanzoai
import (
"encoding/json"
)
// checks if the CartItemSet type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &CartItemSet{}
// CartItemSet struct for CartItemSet
type CartItemSet struct {
// ID is the cart to amend, from the path.
Id *string `json:"id,omitempty"`
// Product names the catalog product to set, by its id or its URL slug. Give this or Variant, never both; a request naming neither is refused.
Product *string `json:"product,omitempty"`
// Quantity is how many of that item the cart should hold AFTER this call — it is the resulting count, not a delta, so sending 3 twice leaves 3 and not 6. ZERO REMOVES the line, which is the only way to take an item out.
Quantity *int64 `json:"quantity,omitempty"`
// Variant names the specific sellable variant to set, by its id or its SKU. Prefer it over Product for anything sold in sizes, colours or tiers — the price and the stock are the variant's, not the product's.
Variant *string `json:"variant,omitempty"`
AdditionalProperties map[string]interface{}
}
type _CartItemSet CartItemSet
// NewCartItemSet instantiates a new CartItemSet 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 NewCartItemSet() *CartItemSet {
this := CartItemSet{}
return &this
}
// NewCartItemSetWithDefaults instantiates a new CartItemSet 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 NewCartItemSetWithDefaults() *CartItemSet {
this := CartItemSet{}
return &this
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *CartItemSet) GetId() string {
if o == nil || IsNil(o.Id) {
var ret string
return ret
}
return *o.Id
}
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CartItemSet) GetIdOk() (*string, bool) {
if o == nil || IsNil(o.Id) {
return nil, false
}
return o.Id, true
}
// HasId returns a boolean if a field has been set.
func (o *CartItemSet) HasId() bool {
if o != nil && !IsNil(o.Id) {
return true
}
return false
}
// SetId gets a reference to the given string and assigns it to the Id field.
func (o *CartItemSet) SetId(v string) {
o.Id = &v
}
// GetProduct returns the Product field value if set, zero value otherwise.
func (o *CartItemSet) GetProduct() string {
if o == nil || IsNil(o.Product) {
var ret string
return ret
}
return *o.Product
}
// GetProductOk returns a tuple with the Product field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CartItemSet) GetProductOk() (*string, bool) {
if o == nil || IsNil(o.Product) {
return nil, false
}
return o.Product, true
}
// HasProduct returns a boolean if a field has been set.
func (o *CartItemSet) HasProduct() bool {
if o != nil && !IsNil(o.Product) {
return true
}
return false
}
// SetProduct gets a reference to the given string and assigns it to the Product field.
func (o *CartItemSet) SetProduct(v string) {
o.Product = &v
}
// GetQuantity returns the Quantity field value if set, zero value otherwise.
func (o *CartItemSet) GetQuantity() int64 {
if o == nil || IsNil(o.Quantity) {
var ret int64
return ret
}
return *o.Quantity
}
// GetQuantityOk returns a tuple with the Quantity field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CartItemSet) GetQuantityOk() (*int64, bool) {
if o == nil || IsNil(o.Quantity) {
return nil, false
}
return o.Quantity, true
}
// HasQuantity returns a boolean if a field has been set.
func (o *CartItemSet) HasQuantity() bool {
if o != nil && !IsNil(o.Quantity) {
return true
}
return false
}
// SetQuantity gets a reference to the given int64 and assigns it to the Quantity field.
func (o *CartItemSet) SetQuantity(v int64) {
o.Quantity = &v
}
// GetVariant returns the Variant field value if set, zero value otherwise.
func (o *CartItemSet) GetVariant() string {
if o == nil || IsNil(o.Variant) {
var ret string
return ret
}
return *o.Variant
}
// GetVariantOk returns a tuple with the Variant field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CartItemSet) GetVariantOk() (*string, bool) {
if o == nil || IsNil(o.Variant) {
return nil, false
}
return o.Variant, true
}
// HasVariant returns a boolean if a field has been set.
func (o *CartItemSet) HasVariant() bool {
if o != nil && !IsNil(o.Variant) {
return true
}
return false
}
// SetVariant gets a reference to the given string and assigns it to the Variant field.
func (o *CartItemSet) SetVariant(v string) {
o.Variant = &v
}
func (o CartItemSet) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o CartItemSet) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Id) {
toSerialize["id"] = o.Id
}
if !IsNil(o.Product) {
toSerialize["product"] = o.Product
}
if !IsNil(o.Quantity) {
toSerialize["quantity"] = o.Quantity
}
if !IsNil(o.Variant) {
toSerialize["variant"] = o.Variant
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *CartItemSet) UnmarshalJSON(data []byte) (err error) {
varCartItemSet := _CartItemSet{}
err = json.Unmarshal(data, &varCartItemSet)
if err != nil {
return err
}
*o = CartItemSet(varCartItemSet)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "id")
delete(additionalProperties, "product")
delete(additionalProperties, "quantity")
delete(additionalProperties, "variant")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableCartItemSet struct {
value *CartItemSet
isSet bool
}
func (v NullableCartItemSet) Get() *CartItemSet {
return v.value
}
func (v *NullableCartItemSet) Set(val *CartItemSet) {
v.value = val
v.isSet = true
}
func (v NullableCartItemSet) IsSet() bool {
return v.isSet
}
func (v *NullableCartItemSet) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCartItemSet(val *CartItemSet) *NullableCartItemSet {
return &NullableCartItemSet{value: val, isSet: true}
}
func (v NullableCartItemSet) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCartItemSet) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}