Files
sdk/model_ai_rank_usage.go

154 lines
3.8 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 AiRankUsage type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AiRankUsage{}
// AiRankUsage struct for AiRankUsage
type AiRankUsage struct {
TotalTokens *int32 `json:"total_tokens,omitempty"`
AdditionalProperties map[string]interface{}
}
type _AiRankUsage AiRankUsage
// NewAiRankUsage instantiates a new AiRankUsage 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 NewAiRankUsage() *AiRankUsage {
this := AiRankUsage{}
return &this
}
// NewAiRankUsageWithDefaults instantiates a new AiRankUsage 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 NewAiRankUsageWithDefaults() *AiRankUsage {
this := AiRankUsage{}
return &this
}
// GetTotalTokens returns the TotalTokens field value if set, zero value otherwise.
func (o *AiRankUsage) GetTotalTokens() int32 {
if o == nil || IsNil(o.TotalTokens) {
var ret int32
return ret
}
return *o.TotalTokens
}
// GetTotalTokensOk returns a tuple with the TotalTokens field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiRankUsage) GetTotalTokensOk() (*int32, bool) {
if o == nil || IsNil(o.TotalTokens) {
return nil, false
}
return o.TotalTokens, true
}
// HasTotalTokens returns a boolean if a field has been set.
func (o *AiRankUsage) HasTotalTokens() bool {
if o != nil && !IsNil(o.TotalTokens) {
return true
}
return false
}
// SetTotalTokens gets a reference to the given int32 and assigns it to the TotalTokens field.
func (o *AiRankUsage) SetTotalTokens(v int32) {
o.TotalTokens = &v
}
func (o AiRankUsage) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o AiRankUsage) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.TotalTokens) {
toSerialize["total_tokens"] = o.TotalTokens
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *AiRankUsage) UnmarshalJSON(data []byte) (err error) {
varAiRankUsage := _AiRankUsage{}
err = json.Unmarshal(data, &varAiRankUsage)
if err != nil {
return err
}
*o = AiRankUsage(varAiRankUsage)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "total_tokens")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableAiRankUsage struct {
value *AiRankUsage
isSet bool
}
func (v NullableAiRankUsage) Get() *AiRankUsage {
return v.value
}
func (v *NullableAiRankUsage) Set(val *AiRankUsage) {
v.value = val
v.isSet = true
}
func (v NullableAiRankUsage) IsSet() bool {
return v.isSet
}
func (v *NullableAiRankUsage) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAiRankUsage(val *AiRankUsage) *NullableAiRankUsage {
return &NullableAiRankUsage{value: val, isSet: true}
}
func (v NullableAiRankUsage) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAiRankUsage) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}