Files
sdk/model_ai_anthropic_usage.go

339 lines
10 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 AiAnthropicUsage type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AiAnthropicUsage{}
// AiAnthropicUsage struct for AiAnthropicUsage
type AiAnthropicUsage struct {
CacheCreation *AiCacheWrites `json:"cache_creation,omitempty"`
CacheCreationInputTokens *int32 `json:"cache_creation_input_tokens,omitempty"`
CacheReadInputTokens *int32 `json:"cache_read_input_tokens,omitempty"`
InputTokens *int32 `json:"input_tokens,omitempty"`
Iterations []AiAnthropicUsage `json:"iterations,omitempty"`
OutputTokens *int32 `json:"output_tokens,omitempty"`
AdditionalProperties map[string]interface{}
}
type _AiAnthropicUsage AiAnthropicUsage
// NewAiAnthropicUsage instantiates a new AiAnthropicUsage 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 NewAiAnthropicUsage() *AiAnthropicUsage {
this := AiAnthropicUsage{}
return &this
}
// NewAiAnthropicUsageWithDefaults instantiates a new AiAnthropicUsage 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 NewAiAnthropicUsageWithDefaults() *AiAnthropicUsage {
this := AiAnthropicUsage{}
return &this
}
// GetCacheCreation returns the CacheCreation field value if set, zero value otherwise.
func (o *AiAnthropicUsage) GetCacheCreation() AiCacheWrites {
if o == nil || IsNil(o.CacheCreation) {
var ret AiCacheWrites
return ret
}
return *o.CacheCreation
}
// GetCacheCreationOk returns a tuple with the CacheCreation field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiAnthropicUsage) GetCacheCreationOk() (*AiCacheWrites, bool) {
if o == nil || IsNil(o.CacheCreation) {
return nil, false
}
return o.CacheCreation, true
}
// HasCacheCreation returns a boolean if a field has been set.
func (o *AiAnthropicUsage) HasCacheCreation() bool {
if o != nil && !IsNil(o.CacheCreation) {
return true
}
return false
}
// SetCacheCreation gets a reference to the given AiCacheWrites and assigns it to the CacheCreation field.
func (o *AiAnthropicUsage) SetCacheCreation(v AiCacheWrites) {
o.CacheCreation = &v
}
// GetCacheCreationInputTokens returns the CacheCreationInputTokens field value if set, zero value otherwise.
func (o *AiAnthropicUsage) GetCacheCreationInputTokens() int32 {
if o == nil || IsNil(o.CacheCreationInputTokens) {
var ret int32
return ret
}
return *o.CacheCreationInputTokens
}
// GetCacheCreationInputTokensOk returns a tuple with the CacheCreationInputTokens field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiAnthropicUsage) GetCacheCreationInputTokensOk() (*int32, bool) {
if o == nil || IsNil(o.CacheCreationInputTokens) {
return nil, false
}
return o.CacheCreationInputTokens, true
}
// HasCacheCreationInputTokens returns a boolean if a field has been set.
func (o *AiAnthropicUsage) HasCacheCreationInputTokens() bool {
if o != nil && !IsNil(o.CacheCreationInputTokens) {
return true
}
return false
}
// SetCacheCreationInputTokens gets a reference to the given int32 and assigns it to the CacheCreationInputTokens field.
func (o *AiAnthropicUsage) SetCacheCreationInputTokens(v int32) {
o.CacheCreationInputTokens = &v
}
// GetCacheReadInputTokens returns the CacheReadInputTokens field value if set, zero value otherwise.
func (o *AiAnthropicUsage) GetCacheReadInputTokens() int32 {
if o == nil || IsNil(o.CacheReadInputTokens) {
var ret int32
return ret
}
return *o.CacheReadInputTokens
}
// GetCacheReadInputTokensOk returns a tuple with the CacheReadInputTokens field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiAnthropicUsage) GetCacheReadInputTokensOk() (*int32, bool) {
if o == nil || IsNil(o.CacheReadInputTokens) {
return nil, false
}
return o.CacheReadInputTokens, true
}
// HasCacheReadInputTokens returns a boolean if a field has been set.
func (o *AiAnthropicUsage) HasCacheReadInputTokens() bool {
if o != nil && !IsNil(o.CacheReadInputTokens) {
return true
}
return false
}
// SetCacheReadInputTokens gets a reference to the given int32 and assigns it to the CacheReadInputTokens field.
func (o *AiAnthropicUsage) SetCacheReadInputTokens(v int32) {
o.CacheReadInputTokens = &v
}
// GetInputTokens returns the InputTokens field value if set, zero value otherwise.
func (o *AiAnthropicUsage) GetInputTokens() int32 {
if o == nil || IsNil(o.InputTokens) {
var ret int32
return ret
}
return *o.InputTokens
}
// GetInputTokensOk returns a tuple with the InputTokens field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiAnthropicUsage) GetInputTokensOk() (*int32, bool) {
if o == nil || IsNil(o.InputTokens) {
return nil, false
}
return o.InputTokens, true
}
// HasInputTokens returns a boolean if a field has been set.
func (o *AiAnthropicUsage) HasInputTokens() bool {
if o != nil && !IsNil(o.InputTokens) {
return true
}
return false
}
// SetInputTokens gets a reference to the given int32 and assigns it to the InputTokens field.
func (o *AiAnthropicUsage) SetInputTokens(v int32) {
o.InputTokens = &v
}
// GetIterations returns the Iterations field value if set, zero value otherwise.
func (o *AiAnthropicUsage) GetIterations() []AiAnthropicUsage {
if o == nil || IsNil(o.Iterations) {
var ret []AiAnthropicUsage
return ret
}
return o.Iterations
}
// GetIterationsOk returns a tuple with the Iterations field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiAnthropicUsage) GetIterationsOk() ([]AiAnthropicUsage, bool) {
if o == nil || IsNil(o.Iterations) {
return nil, false
}
return o.Iterations, true
}
// HasIterations returns a boolean if a field has been set.
func (o *AiAnthropicUsage) HasIterations() bool {
if o != nil && !IsNil(o.Iterations) {
return true
}
return false
}
// SetIterations gets a reference to the given []AiAnthropicUsage and assigns it to the Iterations field.
func (o *AiAnthropicUsage) SetIterations(v []AiAnthropicUsage) {
o.Iterations = v
}
// GetOutputTokens returns the OutputTokens field value if set, zero value otherwise.
func (o *AiAnthropicUsage) GetOutputTokens() int32 {
if o == nil || IsNil(o.OutputTokens) {
var ret int32
return ret
}
return *o.OutputTokens
}
// GetOutputTokensOk returns a tuple with the OutputTokens field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiAnthropicUsage) GetOutputTokensOk() (*int32, bool) {
if o == nil || IsNil(o.OutputTokens) {
return nil, false
}
return o.OutputTokens, true
}
// HasOutputTokens returns a boolean if a field has been set.
func (o *AiAnthropicUsage) HasOutputTokens() bool {
if o != nil && !IsNil(o.OutputTokens) {
return true
}
return false
}
// SetOutputTokens gets a reference to the given int32 and assigns it to the OutputTokens field.
func (o *AiAnthropicUsage) SetOutputTokens(v int32) {
o.OutputTokens = &v
}
func (o AiAnthropicUsage) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o AiAnthropicUsage) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.CacheCreation) {
toSerialize["cache_creation"] = o.CacheCreation
}
if !IsNil(o.CacheCreationInputTokens) {
toSerialize["cache_creation_input_tokens"] = o.CacheCreationInputTokens
}
if !IsNil(o.CacheReadInputTokens) {
toSerialize["cache_read_input_tokens"] = o.CacheReadInputTokens
}
if !IsNil(o.InputTokens) {
toSerialize["input_tokens"] = o.InputTokens
}
if !IsNil(o.Iterations) {
toSerialize["iterations"] = o.Iterations
}
if !IsNil(o.OutputTokens) {
toSerialize["output_tokens"] = o.OutputTokens
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *AiAnthropicUsage) UnmarshalJSON(data []byte) (err error) {
varAiAnthropicUsage := _AiAnthropicUsage{}
err = json.Unmarshal(data, &varAiAnthropicUsage)
if err != nil {
return err
}
*o = AiAnthropicUsage(varAiAnthropicUsage)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "cache_creation")
delete(additionalProperties, "cache_creation_input_tokens")
delete(additionalProperties, "cache_read_input_tokens")
delete(additionalProperties, "input_tokens")
delete(additionalProperties, "iterations")
delete(additionalProperties, "output_tokens")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableAiAnthropicUsage struct {
value *AiAnthropicUsage
isSet bool
}
func (v NullableAiAnthropicUsage) Get() *AiAnthropicUsage {
return v.value
}
func (v *NullableAiAnthropicUsage) Set(val *AiAnthropicUsage) {
v.value = val
v.isSet = true
}
func (v NullableAiAnthropicUsage) IsSet() bool {
return v.isSet
}
func (v *NullableAiAnthropicUsage) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAiAnthropicUsage(val *AiAnthropicUsage) *NullableAiAnthropicUsage {
return &NullableAiAnthropicUsage{value: val, isSet: true}
}
func (v NullableAiAnthropicUsage) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAiAnthropicUsage) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}