mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
459 lines
13 KiB
Go
459 lines
13 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 UsageSpend type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &UsageSpend{}
|
|
|
|
// UsageSpend struct for UsageSpend
|
|
type UsageSpend struct {
|
|
// Available is false when the commerce ledger was unconfigured or unreachable. Every number below is then an honest zero, NOT a measured one.
|
|
Available *bool `json:"available,omitempty"`
|
|
// AvailableCents is what of that balance is still spendable.
|
|
AvailableCents *int64 `json:"availableCents,omitempty"`
|
|
// BalanceCents is the prepaid wallet's balance, in US cents.
|
|
BalanceCents *int64 `json:"balanceCents,omitempty"`
|
|
// ByCategory is the window's spend split by ledger category, largest first.
|
|
ByCategory []UsageCategorySpend `json:"byCategory,omitempty"`
|
|
// MTDCents is commerce's authoritative month-to-date consumed figure, which is a different period from the window and is not derived from it.
|
|
MtdCents *int64 `json:"mtdCents,omitempty"`
|
|
// OverageCents is month-to-date consumption beyond the plan's allowance.
|
|
OverageCents *int64 `json:"overageCents,omitempty"`
|
|
// Series is the window's spend over time, gap-filled at the window's interval.
|
|
Series []UsageSpendPoint `json:"series,omitempty"`
|
|
// Source names where the roll-up came from.
|
|
Source *string `json:"source,omitempty"`
|
|
// TotalCents is consumption over the requested window, in US cents. It is self-consistent with ByCategory and Series.
|
|
TotalCents *int64 `json:"totalCents,omitempty"`
|
|
AdditionalProperties map[string]interface{}
|
|
}
|
|
|
|
type _UsageSpend UsageSpend
|
|
|
|
// NewUsageSpend instantiates a new UsageSpend 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 NewUsageSpend() *UsageSpend {
|
|
this := UsageSpend{}
|
|
return &this
|
|
}
|
|
|
|
// NewUsageSpendWithDefaults instantiates a new UsageSpend 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 NewUsageSpendWithDefaults() *UsageSpend {
|
|
this := UsageSpend{}
|
|
return &this
|
|
}
|
|
|
|
// GetAvailable returns the Available field value if set, zero value otherwise.
|
|
func (o *UsageSpend) GetAvailable() bool {
|
|
if o == nil || IsNil(o.Available) {
|
|
var ret bool
|
|
return ret
|
|
}
|
|
return *o.Available
|
|
}
|
|
|
|
// GetAvailableOk returns a tuple with the Available field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageSpend) GetAvailableOk() (*bool, bool) {
|
|
if o == nil || IsNil(o.Available) {
|
|
return nil, false
|
|
}
|
|
return o.Available, true
|
|
}
|
|
|
|
// HasAvailable returns a boolean if a field has been set.
|
|
func (o *UsageSpend) HasAvailable() bool {
|
|
if o != nil && !IsNil(o.Available) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetAvailable gets a reference to the given bool and assigns it to the Available field.
|
|
func (o *UsageSpend) SetAvailable(v bool) {
|
|
o.Available = &v
|
|
}
|
|
|
|
// GetAvailableCents returns the AvailableCents field value if set, zero value otherwise.
|
|
func (o *UsageSpend) GetAvailableCents() int64 {
|
|
if o == nil || IsNil(o.AvailableCents) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.AvailableCents
|
|
}
|
|
|
|
// GetAvailableCentsOk returns a tuple with the AvailableCents field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageSpend) GetAvailableCentsOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.AvailableCents) {
|
|
return nil, false
|
|
}
|
|
return o.AvailableCents, true
|
|
}
|
|
|
|
// HasAvailableCents returns a boolean if a field has been set.
|
|
func (o *UsageSpend) HasAvailableCents() bool {
|
|
if o != nil && !IsNil(o.AvailableCents) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetAvailableCents gets a reference to the given int64 and assigns it to the AvailableCents field.
|
|
func (o *UsageSpend) SetAvailableCents(v int64) {
|
|
o.AvailableCents = &v
|
|
}
|
|
|
|
// GetBalanceCents returns the BalanceCents field value if set, zero value otherwise.
|
|
func (o *UsageSpend) GetBalanceCents() int64 {
|
|
if o == nil || IsNil(o.BalanceCents) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.BalanceCents
|
|
}
|
|
|
|
// GetBalanceCentsOk returns a tuple with the BalanceCents field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageSpend) GetBalanceCentsOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.BalanceCents) {
|
|
return nil, false
|
|
}
|
|
return o.BalanceCents, true
|
|
}
|
|
|
|
// HasBalanceCents returns a boolean if a field has been set.
|
|
func (o *UsageSpend) HasBalanceCents() bool {
|
|
if o != nil && !IsNil(o.BalanceCents) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetBalanceCents gets a reference to the given int64 and assigns it to the BalanceCents field.
|
|
func (o *UsageSpend) SetBalanceCents(v int64) {
|
|
o.BalanceCents = &v
|
|
}
|
|
|
|
// GetByCategory returns the ByCategory field value if set, zero value otherwise.
|
|
func (o *UsageSpend) GetByCategory() []UsageCategorySpend {
|
|
if o == nil || IsNil(o.ByCategory) {
|
|
var ret []UsageCategorySpend
|
|
return ret
|
|
}
|
|
return o.ByCategory
|
|
}
|
|
|
|
// GetByCategoryOk returns a tuple with the ByCategory field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageSpend) GetByCategoryOk() ([]UsageCategorySpend, bool) {
|
|
if o == nil || IsNil(o.ByCategory) {
|
|
return nil, false
|
|
}
|
|
return o.ByCategory, true
|
|
}
|
|
|
|
// HasByCategory returns a boolean if a field has been set.
|
|
func (o *UsageSpend) HasByCategory() bool {
|
|
if o != nil && !IsNil(o.ByCategory) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetByCategory gets a reference to the given []UsageCategorySpend and assigns it to the ByCategory field.
|
|
func (o *UsageSpend) SetByCategory(v []UsageCategorySpend) {
|
|
o.ByCategory = v
|
|
}
|
|
|
|
// GetMtdCents returns the MtdCents field value if set, zero value otherwise.
|
|
func (o *UsageSpend) GetMtdCents() int64 {
|
|
if o == nil || IsNil(o.MtdCents) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.MtdCents
|
|
}
|
|
|
|
// GetMtdCentsOk returns a tuple with the MtdCents field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageSpend) GetMtdCentsOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.MtdCents) {
|
|
return nil, false
|
|
}
|
|
return o.MtdCents, true
|
|
}
|
|
|
|
// HasMtdCents returns a boolean if a field has been set.
|
|
func (o *UsageSpend) HasMtdCents() bool {
|
|
if o != nil && !IsNil(o.MtdCents) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetMtdCents gets a reference to the given int64 and assigns it to the MtdCents field.
|
|
func (o *UsageSpend) SetMtdCents(v int64) {
|
|
o.MtdCents = &v
|
|
}
|
|
|
|
// GetOverageCents returns the OverageCents field value if set, zero value otherwise.
|
|
func (o *UsageSpend) GetOverageCents() int64 {
|
|
if o == nil || IsNil(o.OverageCents) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.OverageCents
|
|
}
|
|
|
|
// GetOverageCentsOk returns a tuple with the OverageCents field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageSpend) GetOverageCentsOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.OverageCents) {
|
|
return nil, false
|
|
}
|
|
return o.OverageCents, true
|
|
}
|
|
|
|
// HasOverageCents returns a boolean if a field has been set.
|
|
func (o *UsageSpend) HasOverageCents() bool {
|
|
if o != nil && !IsNil(o.OverageCents) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetOverageCents gets a reference to the given int64 and assigns it to the OverageCents field.
|
|
func (o *UsageSpend) SetOverageCents(v int64) {
|
|
o.OverageCents = &v
|
|
}
|
|
|
|
// GetSeries returns the Series field value if set, zero value otherwise.
|
|
func (o *UsageSpend) GetSeries() []UsageSpendPoint {
|
|
if o == nil || IsNil(o.Series) {
|
|
var ret []UsageSpendPoint
|
|
return ret
|
|
}
|
|
return o.Series
|
|
}
|
|
|
|
// GetSeriesOk returns a tuple with the Series field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageSpend) GetSeriesOk() ([]UsageSpendPoint, bool) {
|
|
if o == nil || IsNil(o.Series) {
|
|
return nil, false
|
|
}
|
|
return o.Series, true
|
|
}
|
|
|
|
// HasSeries returns a boolean if a field has been set.
|
|
func (o *UsageSpend) HasSeries() bool {
|
|
if o != nil && !IsNil(o.Series) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetSeries gets a reference to the given []UsageSpendPoint and assigns it to the Series field.
|
|
func (o *UsageSpend) SetSeries(v []UsageSpendPoint) {
|
|
o.Series = v
|
|
}
|
|
|
|
// GetSource returns the Source field value if set, zero value otherwise.
|
|
func (o *UsageSpend) GetSource() string {
|
|
if o == nil || IsNil(o.Source) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Source
|
|
}
|
|
|
|
// GetSourceOk returns a tuple with the Source field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageSpend) GetSourceOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Source) {
|
|
return nil, false
|
|
}
|
|
return o.Source, true
|
|
}
|
|
|
|
// HasSource returns a boolean if a field has been set.
|
|
func (o *UsageSpend) HasSource() bool {
|
|
if o != nil && !IsNil(o.Source) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetSource gets a reference to the given string and assigns it to the Source field.
|
|
func (o *UsageSpend) SetSource(v string) {
|
|
o.Source = &v
|
|
}
|
|
|
|
// GetTotalCents returns the TotalCents field value if set, zero value otherwise.
|
|
func (o *UsageSpend) 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 *UsageSpend) 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 *UsageSpend) 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 *UsageSpend) SetTotalCents(v int64) {
|
|
o.TotalCents = &v
|
|
}
|
|
|
|
func (o UsageSpend) MarshalJSON() ([]byte, error) {
|
|
toSerialize, err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o UsageSpend) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if !IsNil(o.Available) {
|
|
toSerialize["available"] = o.Available
|
|
}
|
|
if !IsNil(o.AvailableCents) {
|
|
toSerialize["availableCents"] = o.AvailableCents
|
|
}
|
|
if !IsNil(o.BalanceCents) {
|
|
toSerialize["balanceCents"] = o.BalanceCents
|
|
}
|
|
if !IsNil(o.ByCategory) {
|
|
toSerialize["byCategory"] = o.ByCategory
|
|
}
|
|
if !IsNil(o.MtdCents) {
|
|
toSerialize["mtdCents"] = o.MtdCents
|
|
}
|
|
if !IsNil(o.OverageCents) {
|
|
toSerialize["overageCents"] = o.OverageCents
|
|
}
|
|
if !IsNil(o.Series) {
|
|
toSerialize["series"] = o.Series
|
|
}
|
|
if !IsNil(o.Source) {
|
|
toSerialize["source"] = o.Source
|
|
}
|
|
if !IsNil(o.TotalCents) {
|
|
toSerialize["totalCents"] = o.TotalCents
|
|
}
|
|
|
|
for key, value := range o.AdditionalProperties {
|
|
toSerialize[key] = value
|
|
}
|
|
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *UsageSpend) UnmarshalJSON(data []byte) (err error) {
|
|
varUsageSpend := _UsageSpend{}
|
|
|
|
err = json.Unmarshal(data, &varUsageSpend)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = UsageSpend(varUsageSpend)
|
|
|
|
additionalProperties := make(map[string]interface{})
|
|
|
|
if err = json.Unmarshal(data, &additionalProperties); err == nil {
|
|
delete(additionalProperties, "available")
|
|
delete(additionalProperties, "availableCents")
|
|
delete(additionalProperties, "balanceCents")
|
|
delete(additionalProperties, "byCategory")
|
|
delete(additionalProperties, "mtdCents")
|
|
delete(additionalProperties, "overageCents")
|
|
delete(additionalProperties, "series")
|
|
delete(additionalProperties, "source")
|
|
delete(additionalProperties, "totalCents")
|
|
o.AdditionalProperties = additionalProperties
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
type NullableUsageSpend struct {
|
|
value *UsageSpend
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableUsageSpend) Get() *UsageSpend {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableUsageSpend) Set(val *UsageSpend) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableUsageSpend) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableUsageSpend) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableUsageSpend(val *UsageSpend) *NullableUsageSpend {
|
|
return &NullableUsageSpend{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableUsageSpend) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableUsageSpend) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|