Files
sdk/model_usage_category_spend.go

231 lines
6.2 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 UsageCategorySpend type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &UsageCategorySpend{}
// UsageCategorySpend struct for UsageCategorySpend
type UsageCategorySpend struct {
// Category is what the lines metered, as it reads on a bill: \"Desktop sandbox\", \"Agent sessions\", or an AI model's own id. It is the same name /v1/billing/usage gives each row. A line that recorded nothing is \"Uncategorized\".
Category *string `json:"category,omitempty"`
// Cents is what the org spent in that bucket over the window, in US cents.
Cents *int64 `json:"cents,omitempty"`
// Count is how many ledger lines rolled up into it.
Count *int64 `json:"count,omitempty"`
AdditionalProperties map[string]interface{}
}
type _UsageCategorySpend UsageCategorySpend
// NewUsageCategorySpend instantiates a new UsageCategorySpend 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 NewUsageCategorySpend() *UsageCategorySpend {
this := UsageCategorySpend{}
return &this
}
// NewUsageCategorySpendWithDefaults instantiates a new UsageCategorySpend 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 NewUsageCategorySpendWithDefaults() *UsageCategorySpend {
this := UsageCategorySpend{}
return &this
}
// GetCategory returns the Category field value if set, zero value otherwise.
func (o *UsageCategorySpend) GetCategory() string {
if o == nil || IsNil(o.Category) {
var ret string
return ret
}
return *o.Category
}
// GetCategoryOk returns a tuple with the Category field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageCategorySpend) GetCategoryOk() (*string, bool) {
if o == nil || IsNil(o.Category) {
return nil, false
}
return o.Category, true
}
// HasCategory returns a boolean if a field has been set.
func (o *UsageCategorySpend) HasCategory() bool {
if o != nil && !IsNil(o.Category) {
return true
}
return false
}
// SetCategory gets a reference to the given string and assigns it to the Category field.
func (o *UsageCategorySpend) SetCategory(v string) {
o.Category = &v
}
// GetCents returns the Cents field value if set, zero value otherwise.
func (o *UsageCategorySpend) GetCents() int64 {
if o == nil || IsNil(o.Cents) {
var ret int64
return ret
}
return *o.Cents
}
// GetCentsOk returns a tuple with the Cents field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageCategorySpend) GetCentsOk() (*int64, bool) {
if o == nil || IsNil(o.Cents) {
return nil, false
}
return o.Cents, true
}
// HasCents returns a boolean if a field has been set.
func (o *UsageCategorySpend) HasCents() bool {
if o != nil && !IsNil(o.Cents) {
return true
}
return false
}
// SetCents gets a reference to the given int64 and assigns it to the Cents field.
func (o *UsageCategorySpend) SetCents(v int64) {
o.Cents = &v
}
// GetCount returns the Count field value if set, zero value otherwise.
func (o *UsageCategorySpend) GetCount() int64 {
if o == nil || IsNil(o.Count) {
var ret int64
return ret
}
return *o.Count
}
// GetCountOk returns a tuple with the Count field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageCategorySpend) GetCountOk() (*int64, bool) {
if o == nil || IsNil(o.Count) {
return nil, false
}
return o.Count, true
}
// HasCount returns a boolean if a field has been set.
func (o *UsageCategorySpend) HasCount() bool {
if o != nil && !IsNil(o.Count) {
return true
}
return false
}
// SetCount gets a reference to the given int64 and assigns it to the Count field.
func (o *UsageCategorySpend) SetCount(v int64) {
o.Count = &v
}
func (o UsageCategorySpend) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o UsageCategorySpend) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Category) {
toSerialize["category"] = o.Category
}
if !IsNil(o.Cents) {
toSerialize["cents"] = o.Cents
}
if !IsNil(o.Count) {
toSerialize["count"] = o.Count
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *UsageCategorySpend) UnmarshalJSON(data []byte) (err error) {
varUsageCategorySpend := _UsageCategorySpend{}
err = json.Unmarshal(data, &varUsageCategorySpend)
if err != nil {
return err
}
*o = UsageCategorySpend(varUsageCategorySpend)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "category")
delete(additionalProperties, "cents")
delete(additionalProperties, "count")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableUsageCategorySpend struct {
value *UsageCategorySpend
isSet bool
}
func (v NullableUsageCategorySpend) Get() *UsageCategorySpend {
return v.value
}
func (v *NullableUsageCategorySpend) Set(val *UsageCategorySpend) {
v.value = val
v.isSet = true
}
func (v NullableUsageCategorySpend) IsSet() bool {
return v.isSet
}
func (v *NullableUsageCategorySpend) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableUsageCategorySpend(val *UsageCategorySpend) *NullableUsageCategorySpend {
return &NullableUsageCategorySpend{value: val, isSet: true}
}
func (v NullableUsageCategorySpend) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableUsageCategorySpend) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}