mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
269 lines
7.1 KiB
Go
269 lines
7.1 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 UsageProviderRow type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &UsageProviderRow{}
|
|
|
|
// UsageProviderRow struct for UsageProviderRow
|
|
type UsageProviderRow struct {
|
|
// CostCents is what they cost the org, in US cents.
|
|
CostCents *int64 `json:"costCents,omitempty"`
|
|
// Provider is the upstream the requests were routed to, e.g. anthropic.
|
|
Provider *string `json:"provider,omitempty"`
|
|
// Requests is how many completions the org made against that provider.
|
|
Requests *int64 `json:"requests,omitempty"`
|
|
// Tokens is the total tokens those completions consumed, prompt plus completion.
|
|
Tokens *int64 `json:"tokens,omitempty"`
|
|
AdditionalProperties map[string]interface{}
|
|
}
|
|
|
|
type _UsageProviderRow UsageProviderRow
|
|
|
|
// NewUsageProviderRow instantiates a new UsageProviderRow 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 NewUsageProviderRow() *UsageProviderRow {
|
|
this := UsageProviderRow{}
|
|
return &this
|
|
}
|
|
|
|
// NewUsageProviderRowWithDefaults instantiates a new UsageProviderRow 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 NewUsageProviderRowWithDefaults() *UsageProviderRow {
|
|
this := UsageProviderRow{}
|
|
return &this
|
|
}
|
|
|
|
// GetCostCents returns the CostCents field value if set, zero value otherwise.
|
|
func (o *UsageProviderRow) 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 *UsageProviderRow) 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 *UsageProviderRow) 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 *UsageProviderRow) SetCostCents(v int64) {
|
|
o.CostCents = &v
|
|
}
|
|
|
|
// GetProvider returns the Provider field value if set, zero value otherwise.
|
|
func (o *UsageProviderRow) 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 *UsageProviderRow) 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 *UsageProviderRow) 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 *UsageProviderRow) SetProvider(v string) {
|
|
o.Provider = &v
|
|
}
|
|
|
|
// GetRequests returns the Requests field value if set, zero value otherwise.
|
|
func (o *UsageProviderRow) 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 *UsageProviderRow) 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 *UsageProviderRow) 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 *UsageProviderRow) SetRequests(v int64) {
|
|
o.Requests = &v
|
|
}
|
|
|
|
// GetTokens returns the Tokens field value if set, zero value otherwise.
|
|
func (o *UsageProviderRow) GetTokens() int64 {
|
|
if o == nil || IsNil(o.Tokens) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.Tokens
|
|
}
|
|
|
|
// GetTokensOk returns a tuple with the Tokens field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageProviderRow) GetTokensOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.Tokens) {
|
|
return nil, false
|
|
}
|
|
return o.Tokens, true
|
|
}
|
|
|
|
// HasTokens returns a boolean if a field has been set.
|
|
func (o *UsageProviderRow) HasTokens() bool {
|
|
if o != nil && !IsNil(o.Tokens) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetTokens gets a reference to the given int64 and assigns it to the Tokens field.
|
|
func (o *UsageProviderRow) SetTokens(v int64) {
|
|
o.Tokens = &v
|
|
}
|
|
|
|
func (o UsageProviderRow) MarshalJSON() ([]byte, error) {
|
|
toSerialize, err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o UsageProviderRow) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if !IsNil(o.CostCents) {
|
|
toSerialize["costCents"] = o.CostCents
|
|
}
|
|
if !IsNil(o.Provider) {
|
|
toSerialize["provider"] = o.Provider
|
|
}
|
|
if !IsNil(o.Requests) {
|
|
toSerialize["requests"] = o.Requests
|
|
}
|
|
if !IsNil(o.Tokens) {
|
|
toSerialize["tokens"] = o.Tokens
|
|
}
|
|
|
|
for key, value := range o.AdditionalProperties {
|
|
toSerialize[key] = value
|
|
}
|
|
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *UsageProviderRow) UnmarshalJSON(data []byte) (err error) {
|
|
varUsageProviderRow := _UsageProviderRow{}
|
|
|
|
err = json.Unmarshal(data, &varUsageProviderRow)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = UsageProviderRow(varUsageProviderRow)
|
|
|
|
additionalProperties := make(map[string]interface{})
|
|
|
|
if err = json.Unmarshal(data, &additionalProperties); err == nil {
|
|
delete(additionalProperties, "costCents")
|
|
delete(additionalProperties, "provider")
|
|
delete(additionalProperties, "requests")
|
|
delete(additionalProperties, "tokens")
|
|
o.AdditionalProperties = additionalProperties
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
type NullableUsageProviderRow struct {
|
|
value *UsageProviderRow
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableUsageProviderRow) Get() *UsageProviderRow {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableUsageProviderRow) Set(val *UsageProviderRow) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableUsageProviderRow) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableUsageProviderRow) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableUsageProviderRow(val *UsageProviderRow) *NullableUsageProviderRow {
|
|
return &NullableUsageProviderRow{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableUsageProviderRow) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableUsageProviderRow) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|