Files
sdk/model_line_item.go

191 lines
4.7 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 LineItem type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &LineItem{}
// LineItem struct for LineItem
type LineItem struct {
AmountCents *int32 `json:"amountCents,omitempty"`
Description *string `json:"description,omitempty"`
AdditionalProperties map[string]interface{}
}
type _LineItem LineItem
// NewLineItem instantiates a new LineItem 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 NewLineItem() *LineItem {
this := LineItem{}
return &this
}
// NewLineItemWithDefaults instantiates a new LineItem 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 NewLineItemWithDefaults() *LineItem {
this := LineItem{}
return &this
}
// GetAmountCents returns the AmountCents field value if set, zero value otherwise.
func (o *LineItem) GetAmountCents() int32 {
if o == nil || IsNil(o.AmountCents) {
var ret int32
return ret
}
return *o.AmountCents
}
// GetAmountCentsOk returns a tuple with the AmountCents field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LineItem) GetAmountCentsOk() (*int32, bool) {
if o == nil || IsNil(o.AmountCents) {
return nil, false
}
return o.AmountCents, true
}
// HasAmountCents returns a boolean if a field has been set.
func (o *LineItem) HasAmountCents() bool {
if o != nil && !IsNil(o.AmountCents) {
return true
}
return false
}
// SetAmountCents gets a reference to the given int32 and assigns it to the AmountCents field.
func (o *LineItem) SetAmountCents(v int32) {
o.AmountCents = &v
}
// GetDescription returns the Description field value if set, zero value otherwise.
func (o *LineItem) GetDescription() string {
if o == nil || IsNil(o.Description) {
var ret string
return ret
}
return *o.Description
}
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LineItem) GetDescriptionOk() (*string, bool) {
if o == nil || IsNil(o.Description) {
return nil, false
}
return o.Description, true
}
// HasDescription returns a boolean if a field has been set.
func (o *LineItem) HasDescription() bool {
if o != nil && !IsNil(o.Description) {
return true
}
return false
}
// SetDescription gets a reference to the given string and assigns it to the Description field.
func (o *LineItem) SetDescription(v string) {
o.Description = &v
}
func (o LineItem) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o LineItem) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.AmountCents) {
toSerialize["amountCents"] = o.AmountCents
}
if !IsNil(o.Description) {
toSerialize["description"] = o.Description
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *LineItem) UnmarshalJSON(data []byte) (err error) {
varLineItem := _LineItem{}
err = json.Unmarshal(data, &varLineItem)
if err != nil {
return err
}
*o = LineItem(varLineItem)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "amountCents")
delete(additionalProperties, "description")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableLineItem struct {
value *LineItem
isSet bool
}
func (v NullableLineItem) Get() *LineItem {
return v.value
}
func (v *NullableLineItem) Set(val *LineItem) {
v.value = val
v.isSet = true
}
func (v NullableLineItem) IsSet() bool {
return v.isSet
}
func (v *NullableLineItem) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableLineItem(val *LineItem) *NullableLineItem {
return &NullableLineItem{value: val, isSet: true}
}
func (v NullableLineItem) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableLineItem) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}