Files
sdk/model_link_routed_usage.go

459 lines
12 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 LinkRoutedUsage type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &LinkRoutedUsage{}
// LinkRoutedUsage struct for LinkRoutedUsage
type LinkRoutedUsage struct {
// Account is the provider-side account identifier.
Account *string `json:"account,omitempty"`
// Billing is how the routed inference bills: plan or commerce.
Billing *string `json:"billing,omitempty"`
// CompletionTokens is the routed completion-token count.
CompletionTokens *int64 `json:"completionTokens,omitempty"`
// CostCents is the routed cost in cents.
CostCents *int64 `json:"costCents,omitempty"`
// Kind is how the account authenticates: subscription or apikey.
Kind *string `json:"kind,omitempty"`
// PromptTokens is the routed prompt-token count.
PromptTokens *int64 `json:"promptTokens,omitempty"`
// Provider is the AI provider the row's account belongs to.
Provider *string `json:"provider,omitempty"`
// Requests is how many requests the gateway routed through this account.
Requests *int64 `json:"requests,omitempty"`
// TotalTokens is the routed total token count.
TotalTokens *int64 `json:"totalTokens,omitempty"`
AdditionalProperties map[string]interface{}
}
type _LinkRoutedUsage LinkRoutedUsage
// NewLinkRoutedUsage instantiates a new LinkRoutedUsage 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 NewLinkRoutedUsage() *LinkRoutedUsage {
this := LinkRoutedUsage{}
return &this
}
// NewLinkRoutedUsageWithDefaults instantiates a new LinkRoutedUsage 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 NewLinkRoutedUsageWithDefaults() *LinkRoutedUsage {
this := LinkRoutedUsage{}
return &this
}
// GetAccount returns the Account field value if set, zero value otherwise.
func (o *LinkRoutedUsage) GetAccount() string {
if o == nil || IsNil(o.Account) {
var ret string
return ret
}
return *o.Account
}
// GetAccountOk returns a tuple with the Account field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LinkRoutedUsage) GetAccountOk() (*string, bool) {
if o == nil || IsNil(o.Account) {
return nil, false
}
return o.Account, true
}
// HasAccount returns a boolean if a field has been set.
func (o *LinkRoutedUsage) HasAccount() bool {
if o != nil && !IsNil(o.Account) {
return true
}
return false
}
// SetAccount gets a reference to the given string and assigns it to the Account field.
func (o *LinkRoutedUsage) SetAccount(v string) {
o.Account = &v
}
// GetBilling returns the Billing field value if set, zero value otherwise.
func (o *LinkRoutedUsage) GetBilling() string {
if o == nil || IsNil(o.Billing) {
var ret string
return ret
}
return *o.Billing
}
// GetBillingOk returns a tuple with the Billing field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LinkRoutedUsage) GetBillingOk() (*string, bool) {
if o == nil || IsNil(o.Billing) {
return nil, false
}
return o.Billing, true
}
// HasBilling returns a boolean if a field has been set.
func (o *LinkRoutedUsage) HasBilling() bool {
if o != nil && !IsNil(o.Billing) {
return true
}
return false
}
// SetBilling gets a reference to the given string and assigns it to the Billing field.
func (o *LinkRoutedUsage) SetBilling(v string) {
o.Billing = &v
}
// GetCompletionTokens returns the CompletionTokens field value if set, zero value otherwise.
func (o *LinkRoutedUsage) GetCompletionTokens() int64 {
if o == nil || IsNil(o.CompletionTokens) {
var ret int64
return ret
}
return *o.CompletionTokens
}
// GetCompletionTokensOk returns a tuple with the CompletionTokens field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LinkRoutedUsage) GetCompletionTokensOk() (*int64, bool) {
if o == nil || IsNil(o.CompletionTokens) {
return nil, false
}
return o.CompletionTokens, true
}
// HasCompletionTokens returns a boolean if a field has been set.
func (o *LinkRoutedUsage) HasCompletionTokens() bool {
if o != nil && !IsNil(o.CompletionTokens) {
return true
}
return false
}
// SetCompletionTokens gets a reference to the given int64 and assigns it to the CompletionTokens field.
func (o *LinkRoutedUsage) SetCompletionTokens(v int64) {
o.CompletionTokens = &v
}
// GetCostCents returns the CostCents field value if set, zero value otherwise.
func (o *LinkRoutedUsage) GetCostCents() int64 {
if o == nil || IsNil(o.CostCents) {
var ret int64
return ret
}
return *o.CostCents
}
// GetCostCentsOk returns a tuple with the CostCents field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LinkRoutedUsage) GetCostCentsOk() (*int64, bool) {
if o == nil || IsNil(o.CostCents) {
return nil, false
}
return o.CostCents, true
}
// HasCostCents returns a boolean if a field has been set.
func (o *LinkRoutedUsage) HasCostCents() bool {
if o != nil && !IsNil(o.CostCents) {
return true
}
return false
}
// SetCostCents gets a reference to the given int64 and assigns it to the CostCents field.
func (o *LinkRoutedUsage) SetCostCents(v int64) {
o.CostCents = &v
}
// GetKind returns the Kind field value if set, zero value otherwise.
func (o *LinkRoutedUsage) GetKind() string {
if o == nil || IsNil(o.Kind) {
var ret string
return ret
}
return *o.Kind
}
// GetKindOk returns a tuple with the Kind field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LinkRoutedUsage) GetKindOk() (*string, bool) {
if o == nil || IsNil(o.Kind) {
return nil, false
}
return o.Kind, true
}
// HasKind returns a boolean if a field has been set.
func (o *LinkRoutedUsage) HasKind() bool {
if o != nil && !IsNil(o.Kind) {
return true
}
return false
}
// SetKind gets a reference to the given string and assigns it to the Kind field.
func (o *LinkRoutedUsage) SetKind(v string) {
o.Kind = &v
}
// GetPromptTokens returns the PromptTokens field value if set, zero value otherwise.
func (o *LinkRoutedUsage) GetPromptTokens() int64 {
if o == nil || IsNil(o.PromptTokens) {
var ret int64
return ret
}
return *o.PromptTokens
}
// GetPromptTokensOk returns a tuple with the PromptTokens field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LinkRoutedUsage) GetPromptTokensOk() (*int64, bool) {
if o == nil || IsNil(o.PromptTokens) {
return nil, false
}
return o.PromptTokens, true
}
// HasPromptTokens returns a boolean if a field has been set.
func (o *LinkRoutedUsage) HasPromptTokens() bool {
if o != nil && !IsNil(o.PromptTokens) {
return true
}
return false
}
// SetPromptTokens gets a reference to the given int64 and assigns it to the PromptTokens field.
func (o *LinkRoutedUsage) SetPromptTokens(v int64) {
o.PromptTokens = &v
}
// GetProvider returns the Provider field value if set, zero value otherwise.
func (o *LinkRoutedUsage) GetProvider() string {
if o == nil || IsNil(o.Provider) {
var ret string
return ret
}
return *o.Provider
}
// GetProviderOk returns a tuple with the Provider field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LinkRoutedUsage) GetProviderOk() (*string, bool) {
if o == nil || IsNil(o.Provider) {
return nil, false
}
return o.Provider, true
}
// HasProvider returns a boolean if a field has been set.
func (o *LinkRoutedUsage) HasProvider() bool {
if o != nil && !IsNil(o.Provider) {
return true
}
return false
}
// SetProvider gets a reference to the given string and assigns it to the Provider field.
func (o *LinkRoutedUsage) SetProvider(v string) {
o.Provider = &v
}
// GetRequests returns the Requests field value if set, zero value otherwise.
func (o *LinkRoutedUsage) GetRequests() int64 {
if o == nil || IsNil(o.Requests) {
var ret int64
return ret
}
return *o.Requests
}
// GetRequestsOk returns a tuple with the Requests field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LinkRoutedUsage) GetRequestsOk() (*int64, bool) {
if o == nil || IsNil(o.Requests) {
return nil, false
}
return o.Requests, true
}
// HasRequests returns a boolean if a field has been set.
func (o *LinkRoutedUsage) HasRequests() bool {
if o != nil && !IsNil(o.Requests) {
return true
}
return false
}
// SetRequests gets a reference to the given int64 and assigns it to the Requests field.
func (o *LinkRoutedUsage) SetRequests(v int64) {
o.Requests = &v
}
// GetTotalTokens returns the TotalTokens field value if set, zero value otherwise.
func (o *LinkRoutedUsage) GetTotalTokens() int64 {
if o == nil || IsNil(o.TotalTokens) {
var ret int64
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 *LinkRoutedUsage) GetTotalTokensOk() (*int64, 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 *LinkRoutedUsage) HasTotalTokens() bool {
if o != nil && !IsNil(o.TotalTokens) {
return true
}
return false
}
// SetTotalTokens gets a reference to the given int64 and assigns it to the TotalTokens field.
func (o *LinkRoutedUsage) SetTotalTokens(v int64) {
o.TotalTokens = &v
}
func (o LinkRoutedUsage) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o LinkRoutedUsage) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Account) {
toSerialize["account"] = o.Account
}
if !IsNil(o.Billing) {
toSerialize["billing"] = o.Billing
}
if !IsNil(o.CompletionTokens) {
toSerialize["completionTokens"] = o.CompletionTokens
}
if !IsNil(o.CostCents) {
toSerialize["costCents"] = o.CostCents
}
if !IsNil(o.Kind) {
toSerialize["kind"] = o.Kind
}
if !IsNil(o.PromptTokens) {
toSerialize["promptTokens"] = o.PromptTokens
}
if !IsNil(o.Provider) {
toSerialize["provider"] = o.Provider
}
if !IsNil(o.Requests) {
toSerialize["requests"] = o.Requests
}
if !IsNil(o.TotalTokens) {
toSerialize["totalTokens"] = o.TotalTokens
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *LinkRoutedUsage) UnmarshalJSON(data []byte) (err error) {
varLinkRoutedUsage := _LinkRoutedUsage{}
err = json.Unmarshal(data, &varLinkRoutedUsage)
if err != nil {
return err
}
*o = LinkRoutedUsage(varLinkRoutedUsage)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "account")
delete(additionalProperties, "billing")
delete(additionalProperties, "completionTokens")
delete(additionalProperties, "costCents")
delete(additionalProperties, "kind")
delete(additionalProperties, "promptTokens")
delete(additionalProperties, "provider")
delete(additionalProperties, "requests")
delete(additionalProperties, "totalTokens")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableLinkRoutedUsage struct {
value *LinkRoutedUsage
isSet bool
}
func (v NullableLinkRoutedUsage) Get() *LinkRoutedUsage {
return v.value
}
func (v *NullableLinkRoutedUsage) Set(val *LinkRoutedUsage) {
v.value = val
v.isSet = true
}
func (v NullableLinkRoutedUsage) IsSet() bool {
return v.isSet
}
func (v *NullableLinkRoutedUsage) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableLinkRoutedUsage(val *LinkRoutedUsage) *NullableLinkRoutedUsage {
return &NullableLinkRoutedUsage{value: val, isSet: true}
}
func (v NullableLinkRoutedUsage) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableLinkRoutedUsage) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}