Files
sdk/model_cart.go

725 lines
19 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 Cart type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Cart{}
// Cart struct for Cart
type Cart struct {
// CreatedAt is when the cart was opened, RFC3339.
CreatedAt *string `json:"createdAt,omitempty"`
// Currency is the ISO 4217 code every amount below is denominated in.
Currency *string `json:"currency,omitempty"`
// DiscountCents is what coupons and promotions took off, in whole cents.
DiscountCents *int64 `json:"discountCents,omitempty"`
// Email is the shopper's address, when the cart carries one.
Email *string `json:"email,omitempty"`
// ID is the cart's id — what every other cart op addresses it by, and what a storefront persists against the browser session.
Id *string `json:"id,omitempty"`
// Items are the cart's lines, in the order they were added.
Items []CartItem `json:"items,omitempty"`
// LineTotalCents is the sum of the lines before any discount, in whole cents.
LineTotalCents *int64 `json:"lineTotalCents,omitempty"`
// Order is the order this cart became, once checkout completed it. Empty until then, and its presence is what makes a cart final.
Order *string `json:"order,omitempty"`
// ShippingCents is the shipping charge, in whole cents. It stays zero until a shipping option is priced at checkout.
ShippingCents *int64 `json:"shippingCents,omitempty"`
// Status is \"active\" for a cart still being filled, \"ordered\" once checkout turned it into an order, and \"discarded\" when the shopper abandoned it.
Status *string `json:"status,omitempty"`
// Store is the storefront the cart is being filled on.
Store *string `json:"store,omitempty"`
// SubtotalCents is LineTotalCents less DiscountCents, in whole cents.
SubtotalCents *int64 `json:"subtotalCents,omitempty"`
// TaxCents is the sales tax, in whole cents. It stays zero until checkout resolves the shopper's tax region.
TaxCents *int64 `json:"taxCents,omitempty"`
// TotalCents is what the shopper pays: subtotal plus shipping plus tax, in whole cents.
TotalCents *int64 `json:"totalCents,omitempty"`
// UpdatedAt is when the cart was last amended, RFC3339.
UpdatedAt *string `json:"updatedAt,omitempty"`
// User is the signed-in shopper this cart belongs to, empty for a guest cart.
User *string `json:"user,omitempty"`
AdditionalProperties map[string]interface{}
}
type _Cart Cart
// NewCart instantiates a new Cart 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 NewCart() *Cart {
this := Cart{}
return &this
}
// NewCartWithDefaults instantiates a new Cart 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 NewCartWithDefaults() *Cart {
this := Cart{}
return &this
}
// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise.
func (o *Cart) GetCreatedAt() string {
if o == nil || IsNil(o.CreatedAt) {
var ret string
return ret
}
return *o.CreatedAt
}
// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cart) GetCreatedAtOk() (*string, bool) {
if o == nil || IsNil(o.CreatedAt) {
return nil, false
}
return o.CreatedAt, true
}
// HasCreatedAt returns a boolean if a field has been set.
func (o *Cart) HasCreatedAt() bool {
if o != nil && !IsNil(o.CreatedAt) {
return true
}
return false
}
// SetCreatedAt gets a reference to the given string and assigns it to the CreatedAt field.
func (o *Cart) SetCreatedAt(v string) {
o.CreatedAt = &v
}
// GetCurrency returns the Currency field value if set, zero value otherwise.
func (o *Cart) GetCurrency() string {
if o == nil || IsNil(o.Currency) {
var ret string
return ret
}
return *o.Currency
}
// GetCurrencyOk returns a tuple with the Currency field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cart) GetCurrencyOk() (*string, bool) {
if o == nil || IsNil(o.Currency) {
return nil, false
}
return o.Currency, true
}
// HasCurrency returns a boolean if a field has been set.
func (o *Cart) HasCurrency() bool {
if o != nil && !IsNil(o.Currency) {
return true
}
return false
}
// SetCurrency gets a reference to the given string and assigns it to the Currency field.
func (o *Cart) SetCurrency(v string) {
o.Currency = &v
}
// GetDiscountCents returns the DiscountCents field value if set, zero value otherwise.
func (o *Cart) GetDiscountCents() int64 {
if o == nil || IsNil(o.DiscountCents) {
var ret int64
return ret
}
return *o.DiscountCents
}
// GetDiscountCentsOk returns a tuple with the DiscountCents field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cart) GetDiscountCentsOk() (*int64, bool) {
if o == nil || IsNil(o.DiscountCents) {
return nil, false
}
return o.DiscountCents, true
}
// HasDiscountCents returns a boolean if a field has been set.
func (o *Cart) HasDiscountCents() bool {
if o != nil && !IsNil(o.DiscountCents) {
return true
}
return false
}
// SetDiscountCents gets a reference to the given int64 and assigns it to the DiscountCents field.
func (o *Cart) SetDiscountCents(v int64) {
o.DiscountCents = &v
}
// GetEmail returns the Email field value if set, zero value otherwise.
func (o *Cart) GetEmail() string {
if o == nil || IsNil(o.Email) {
var ret string
return ret
}
return *o.Email
}
// GetEmailOk returns a tuple with the Email field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cart) GetEmailOk() (*string, bool) {
if o == nil || IsNil(o.Email) {
return nil, false
}
return o.Email, true
}
// HasEmail returns a boolean if a field has been set.
func (o *Cart) HasEmail() bool {
if o != nil && !IsNil(o.Email) {
return true
}
return false
}
// SetEmail gets a reference to the given string and assigns it to the Email field.
func (o *Cart) SetEmail(v string) {
o.Email = &v
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *Cart) 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 *Cart) 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 *Cart) 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 *Cart) SetId(v string) {
o.Id = &v
}
// GetItems returns the Items field value if set, zero value otherwise.
func (o *Cart) GetItems() []CartItem {
if o == nil || IsNil(o.Items) {
var ret []CartItem
return ret
}
return o.Items
}
// GetItemsOk returns a tuple with the Items field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cart) GetItemsOk() ([]CartItem, bool) {
if o == nil || IsNil(o.Items) {
return nil, false
}
return o.Items, true
}
// HasItems returns a boolean if a field has been set.
func (o *Cart) HasItems() bool {
if o != nil && !IsNil(o.Items) {
return true
}
return false
}
// SetItems gets a reference to the given []CartItem and assigns it to the Items field.
func (o *Cart) SetItems(v []CartItem) {
o.Items = v
}
// GetLineTotalCents returns the LineTotalCents field value if set, zero value otherwise.
func (o *Cart) GetLineTotalCents() int64 {
if o == nil || IsNil(o.LineTotalCents) {
var ret int64
return ret
}
return *o.LineTotalCents
}
// GetLineTotalCentsOk returns a tuple with the LineTotalCents field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cart) GetLineTotalCentsOk() (*int64, bool) {
if o == nil || IsNil(o.LineTotalCents) {
return nil, false
}
return o.LineTotalCents, true
}
// HasLineTotalCents returns a boolean if a field has been set.
func (o *Cart) HasLineTotalCents() bool {
if o != nil && !IsNil(o.LineTotalCents) {
return true
}
return false
}
// SetLineTotalCents gets a reference to the given int64 and assigns it to the LineTotalCents field.
func (o *Cart) SetLineTotalCents(v int64) {
o.LineTotalCents = &v
}
// GetOrder returns the Order field value if set, zero value otherwise.
func (o *Cart) GetOrder() string {
if o == nil || IsNil(o.Order) {
var ret string
return ret
}
return *o.Order
}
// GetOrderOk returns a tuple with the Order field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cart) GetOrderOk() (*string, bool) {
if o == nil || IsNil(o.Order) {
return nil, false
}
return o.Order, true
}
// HasOrder returns a boolean if a field has been set.
func (o *Cart) HasOrder() bool {
if o != nil && !IsNil(o.Order) {
return true
}
return false
}
// SetOrder gets a reference to the given string and assigns it to the Order field.
func (o *Cart) SetOrder(v string) {
o.Order = &v
}
// GetShippingCents returns the ShippingCents field value if set, zero value otherwise.
func (o *Cart) GetShippingCents() int64 {
if o == nil || IsNil(o.ShippingCents) {
var ret int64
return ret
}
return *o.ShippingCents
}
// GetShippingCentsOk returns a tuple with the ShippingCents field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cart) GetShippingCentsOk() (*int64, bool) {
if o == nil || IsNil(o.ShippingCents) {
return nil, false
}
return o.ShippingCents, true
}
// HasShippingCents returns a boolean if a field has been set.
func (o *Cart) HasShippingCents() bool {
if o != nil && !IsNil(o.ShippingCents) {
return true
}
return false
}
// SetShippingCents gets a reference to the given int64 and assigns it to the ShippingCents field.
func (o *Cart) SetShippingCents(v int64) {
o.ShippingCents = &v
}
// GetStatus returns the Status field value if set, zero value otherwise.
func (o *Cart) GetStatus() string {
if o == nil || IsNil(o.Status) {
var ret string
return ret
}
return *o.Status
}
// GetStatusOk returns a tuple with the Status field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cart) GetStatusOk() (*string, bool) {
if o == nil || IsNil(o.Status) {
return nil, false
}
return o.Status, true
}
// HasStatus returns a boolean if a field has been set.
func (o *Cart) HasStatus() bool {
if o != nil && !IsNil(o.Status) {
return true
}
return false
}
// SetStatus gets a reference to the given string and assigns it to the Status field.
func (o *Cart) SetStatus(v string) {
o.Status = &v
}
// GetStore returns the Store field value if set, zero value otherwise.
func (o *Cart) GetStore() string {
if o == nil || IsNil(o.Store) {
var ret string
return ret
}
return *o.Store
}
// GetStoreOk returns a tuple with the Store field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cart) GetStoreOk() (*string, bool) {
if o == nil || IsNil(o.Store) {
return nil, false
}
return o.Store, true
}
// HasStore returns a boolean if a field has been set.
func (o *Cart) HasStore() bool {
if o != nil && !IsNil(o.Store) {
return true
}
return false
}
// SetStore gets a reference to the given string and assigns it to the Store field.
func (o *Cart) SetStore(v string) {
o.Store = &v
}
// GetSubtotalCents returns the SubtotalCents field value if set, zero value otherwise.
func (o *Cart) GetSubtotalCents() int64 {
if o == nil || IsNil(o.SubtotalCents) {
var ret int64
return ret
}
return *o.SubtotalCents
}
// GetSubtotalCentsOk returns a tuple with the SubtotalCents field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cart) GetSubtotalCentsOk() (*int64, bool) {
if o == nil || IsNil(o.SubtotalCents) {
return nil, false
}
return o.SubtotalCents, true
}
// HasSubtotalCents returns a boolean if a field has been set.
func (o *Cart) HasSubtotalCents() bool {
if o != nil && !IsNil(o.SubtotalCents) {
return true
}
return false
}
// SetSubtotalCents gets a reference to the given int64 and assigns it to the SubtotalCents field.
func (o *Cart) SetSubtotalCents(v int64) {
o.SubtotalCents = &v
}
// GetTaxCents returns the TaxCents field value if set, zero value otherwise.
func (o *Cart) GetTaxCents() int64 {
if o == nil || IsNil(o.TaxCents) {
var ret int64
return ret
}
return *o.TaxCents
}
// GetTaxCentsOk returns a tuple with the TaxCents field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cart) GetTaxCentsOk() (*int64, bool) {
if o == nil || IsNil(o.TaxCents) {
return nil, false
}
return o.TaxCents, true
}
// HasTaxCents returns a boolean if a field has been set.
func (o *Cart) HasTaxCents() bool {
if o != nil && !IsNil(o.TaxCents) {
return true
}
return false
}
// SetTaxCents gets a reference to the given int64 and assigns it to the TaxCents field.
func (o *Cart) SetTaxCents(v int64) {
o.TaxCents = &v
}
// GetTotalCents returns the TotalCents field value if set, zero value otherwise.
func (o *Cart) GetTotalCents() int64 {
if o == nil || IsNil(o.TotalCents) {
var ret int64
return ret
}
return *o.TotalCents
}
// GetTotalCentsOk returns a tuple with the TotalCents field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cart) GetTotalCentsOk() (*int64, bool) {
if o == nil || IsNil(o.TotalCents) {
return nil, false
}
return o.TotalCents, true
}
// HasTotalCents returns a boolean if a field has been set.
func (o *Cart) HasTotalCents() bool {
if o != nil && !IsNil(o.TotalCents) {
return true
}
return false
}
// SetTotalCents gets a reference to the given int64 and assigns it to the TotalCents field.
func (o *Cart) SetTotalCents(v int64) {
o.TotalCents = &v
}
// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise.
func (o *Cart) GetUpdatedAt() string {
if o == nil || IsNil(o.UpdatedAt) {
var ret string
return ret
}
return *o.UpdatedAt
}
// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cart) GetUpdatedAtOk() (*string, bool) {
if o == nil || IsNil(o.UpdatedAt) {
return nil, false
}
return o.UpdatedAt, true
}
// HasUpdatedAt returns a boolean if a field has been set.
func (o *Cart) HasUpdatedAt() bool {
if o != nil && !IsNil(o.UpdatedAt) {
return true
}
return false
}
// SetUpdatedAt gets a reference to the given string and assigns it to the UpdatedAt field.
func (o *Cart) SetUpdatedAt(v string) {
o.UpdatedAt = &v
}
// GetUser returns the User field value if set, zero value otherwise.
func (o *Cart) GetUser() string {
if o == nil || IsNil(o.User) {
var ret string
return ret
}
return *o.User
}
// GetUserOk returns a tuple with the User field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cart) GetUserOk() (*string, bool) {
if o == nil || IsNil(o.User) {
return nil, false
}
return o.User, true
}
// HasUser returns a boolean if a field has been set.
func (o *Cart) HasUser() bool {
if o != nil && !IsNil(o.User) {
return true
}
return false
}
// SetUser gets a reference to the given string and assigns it to the User field.
func (o *Cart) SetUser(v string) {
o.User = &v
}
func (o Cart) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o Cart) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.CreatedAt) {
toSerialize["createdAt"] = o.CreatedAt
}
if !IsNil(o.Currency) {
toSerialize["currency"] = o.Currency
}
if !IsNil(o.DiscountCents) {
toSerialize["discountCents"] = o.DiscountCents
}
if !IsNil(o.Email) {
toSerialize["email"] = o.Email
}
if !IsNil(o.Id) {
toSerialize["id"] = o.Id
}
if !IsNil(o.Items) {
toSerialize["items"] = o.Items
}
if !IsNil(o.LineTotalCents) {
toSerialize["lineTotalCents"] = o.LineTotalCents
}
if !IsNil(o.Order) {
toSerialize["order"] = o.Order
}
if !IsNil(o.ShippingCents) {
toSerialize["shippingCents"] = o.ShippingCents
}
if !IsNil(o.Status) {
toSerialize["status"] = o.Status
}
if !IsNil(o.Store) {
toSerialize["store"] = o.Store
}
if !IsNil(o.SubtotalCents) {
toSerialize["subtotalCents"] = o.SubtotalCents
}
if !IsNil(o.TaxCents) {
toSerialize["taxCents"] = o.TaxCents
}
if !IsNil(o.TotalCents) {
toSerialize["totalCents"] = o.TotalCents
}
if !IsNil(o.UpdatedAt) {
toSerialize["updatedAt"] = o.UpdatedAt
}
if !IsNil(o.User) {
toSerialize["user"] = o.User
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *Cart) UnmarshalJSON(data []byte) (err error) {
varCart := _Cart{}
err = json.Unmarshal(data, &varCart)
if err != nil {
return err
}
*o = Cart(varCart)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "createdAt")
delete(additionalProperties, "currency")
delete(additionalProperties, "discountCents")
delete(additionalProperties, "email")
delete(additionalProperties, "id")
delete(additionalProperties, "items")
delete(additionalProperties, "lineTotalCents")
delete(additionalProperties, "order")
delete(additionalProperties, "shippingCents")
delete(additionalProperties, "status")
delete(additionalProperties, "store")
delete(additionalProperties, "subtotalCents")
delete(additionalProperties, "taxCents")
delete(additionalProperties, "totalCents")
delete(additionalProperties, "updatedAt")
delete(additionalProperties, "user")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableCart struct {
value *Cart
isSet bool
}
func (v NullableCart) Get() *Cart {
return v.value
}
func (v *NullableCart) Set(val *Cart) {
v.value = val
v.isSet = true
}
func (v NullableCart) IsSet() bool {
return v.isSet
}
func (v *NullableCart) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCart(val *Cart) *NullableCart {
return &NullableCart{value: val, isSet: true}
}
func (v NullableCart) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCart) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}