Files
sdk/model_pricing_card.go

269 lines
6.9 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 PricingCard type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &PricingCard{}
// PricingCard struct for PricingCard
type PricingCard struct {
// Components are the four things a bill is made of.
Components []PricingComponent `json:"components,omitempty"`
// Rates are the priced lines, each in micro-USD per its own unit.
Rates []PricingRate `json:"rates,omitempty"`
// Unit is the unit every amount on this card is stated in.
Unit *string `json:"unit,omitempty"`
// Speeds are the completion speeds, dearest first.
Windows []PricingSpeed `json:"windows,omitempty"`
AdditionalProperties map[string]interface{}
}
type _PricingCard PricingCard
// NewPricingCard instantiates a new PricingCard 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 NewPricingCard() *PricingCard {
this := PricingCard{}
return &this
}
// NewPricingCardWithDefaults instantiates a new PricingCard 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 NewPricingCardWithDefaults() *PricingCard {
this := PricingCard{}
return &this
}
// GetComponents returns the Components field value if set, zero value otherwise.
func (o *PricingCard) GetComponents() []PricingComponent {
if o == nil || IsNil(o.Components) {
var ret []PricingComponent
return ret
}
return o.Components
}
// GetComponentsOk returns a tuple with the Components field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PricingCard) GetComponentsOk() ([]PricingComponent, bool) {
if o == nil || IsNil(o.Components) {
return nil, false
}
return o.Components, true
}
// HasComponents returns a boolean if a field has been set.
func (o *PricingCard) HasComponents() bool {
if o != nil && !IsNil(o.Components) {
return true
}
return false
}
// SetComponents gets a reference to the given []PricingComponent and assigns it to the Components field.
func (o *PricingCard) SetComponents(v []PricingComponent) {
o.Components = v
}
// GetRates returns the Rates field value if set, zero value otherwise.
func (o *PricingCard) GetRates() []PricingRate {
if o == nil || IsNil(o.Rates) {
var ret []PricingRate
return ret
}
return o.Rates
}
// GetRatesOk returns a tuple with the Rates field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PricingCard) GetRatesOk() ([]PricingRate, bool) {
if o == nil || IsNil(o.Rates) {
return nil, false
}
return o.Rates, true
}
// HasRates returns a boolean if a field has been set.
func (o *PricingCard) HasRates() bool {
if o != nil && !IsNil(o.Rates) {
return true
}
return false
}
// SetRates gets a reference to the given []PricingRate and assigns it to the Rates field.
func (o *PricingCard) SetRates(v []PricingRate) {
o.Rates = v
}
// GetUnit returns the Unit field value if set, zero value otherwise.
func (o *PricingCard) GetUnit() string {
if o == nil || IsNil(o.Unit) {
var ret string
return ret
}
return *o.Unit
}
// GetUnitOk returns a tuple with the Unit field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PricingCard) GetUnitOk() (*string, bool) {
if o == nil || IsNil(o.Unit) {
return nil, false
}
return o.Unit, true
}
// HasUnit returns a boolean if a field has been set.
func (o *PricingCard) HasUnit() bool {
if o != nil && !IsNil(o.Unit) {
return true
}
return false
}
// SetUnit gets a reference to the given string and assigns it to the Unit field.
func (o *PricingCard) SetUnit(v string) {
o.Unit = &v
}
// GetWindows returns the Windows field value if set, zero value otherwise.
func (o *PricingCard) GetWindows() []PricingSpeed {
if o == nil || IsNil(o.Windows) {
var ret []PricingSpeed
return ret
}
return o.Windows
}
// GetWindowsOk returns a tuple with the Windows field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PricingCard) GetWindowsOk() ([]PricingSpeed, bool) {
if o == nil || IsNil(o.Windows) {
return nil, false
}
return o.Windows, true
}
// HasWindows returns a boolean if a field has been set.
func (o *PricingCard) HasWindows() bool {
if o != nil && !IsNil(o.Windows) {
return true
}
return false
}
// SetWindows gets a reference to the given []PricingSpeed and assigns it to the Windows field.
func (o *PricingCard) SetWindows(v []PricingSpeed) {
o.Windows = v
}
func (o PricingCard) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o PricingCard) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Components) {
toSerialize["components"] = o.Components
}
if !IsNil(o.Rates) {
toSerialize["rates"] = o.Rates
}
if !IsNil(o.Unit) {
toSerialize["unit"] = o.Unit
}
if !IsNil(o.Windows) {
toSerialize["windows"] = o.Windows
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *PricingCard) UnmarshalJSON(data []byte) (err error) {
varPricingCard := _PricingCard{}
err = json.Unmarshal(data, &varPricingCard)
if err != nil {
return err
}
*o = PricingCard(varPricingCard)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "components")
delete(additionalProperties, "rates")
delete(additionalProperties, "unit")
delete(additionalProperties, "windows")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullablePricingCard struct {
value *PricingCard
isSet bool
}
func (v NullablePricingCard) Get() *PricingCard {
return v.value
}
func (v *NullablePricingCard) Set(val *PricingCard) {
v.value = val
v.isSet = true
}
func (v NullablePricingCard) IsSet() bool {
return v.isSet
}
func (v *NullablePricingCard) Unset() {
v.value = nil
v.isSet = false
}
func NewNullablePricingCard(val *PricingCard) *NullablePricingCard {
return &NullablePricingCard{value: val, isSet: true}
}
func (v NullablePricingCard) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullablePricingCard) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}