Files
sdk/model_ai_receipt.go

383 lines
9.6 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 AiReceipt type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AiReceipt{}
// AiReceipt struct for AiReceipt
type AiReceipt struct {
// Class is the model's class as billed: premium, ours or free (X-Hanzo-Usage-Class).
Class *string `json:"class,omitempty"`
// Fallback is the model that answered in place of the one asked, in limited mode (X-Hanzo-Fallback).
Fallback *string `json:"fallback,omitempty"`
// PaidBy is plan, credits or free (X-Hanzo-Paid-By); absent when the answer named no payer, as a free model's does.
PaidBy *string `json:"paid_by,omitempty"`
// Reason is the refusal code that sent the request to the fallback (X-Hanzo-Usage-Reason).
Reason *string `json:"reason,omitempty"`
// Routed is the model `auto` resolved to (X-Routed-Model).
Routed *string `json:"routed,omitempty"`
// Served is the model that answered (X-Hanzo-Served).
Served *string `json:"served,omitempty"`
// Usage is where that class stands for the payer: ok, near or limited (X-Hanzo-Usage).
Usage *string `json:"usage,omitempty"`
AdditionalProperties map[string]interface{}
}
type _AiReceipt AiReceipt
// NewAiReceipt instantiates a new AiReceipt 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 NewAiReceipt() *AiReceipt {
this := AiReceipt{}
return &this
}
// NewAiReceiptWithDefaults instantiates a new AiReceipt 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 NewAiReceiptWithDefaults() *AiReceipt {
this := AiReceipt{}
return &this
}
// GetClass returns the Class field value if set, zero value otherwise.
func (o *AiReceipt) GetClass() string {
if o == nil || IsNil(o.Class) {
var ret string
return ret
}
return *o.Class
}
// GetClassOk returns a tuple with the Class field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiReceipt) GetClassOk() (*string, bool) {
if o == nil || IsNil(o.Class) {
return nil, false
}
return o.Class, true
}
// HasClass returns a boolean if a field has been set.
func (o *AiReceipt) HasClass() bool {
if o != nil && !IsNil(o.Class) {
return true
}
return false
}
// SetClass gets a reference to the given string and assigns it to the Class field.
func (o *AiReceipt) SetClass(v string) {
o.Class = &v
}
// GetFallback returns the Fallback field value if set, zero value otherwise.
func (o *AiReceipt) GetFallback() string {
if o == nil || IsNil(o.Fallback) {
var ret string
return ret
}
return *o.Fallback
}
// GetFallbackOk returns a tuple with the Fallback field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiReceipt) GetFallbackOk() (*string, bool) {
if o == nil || IsNil(o.Fallback) {
return nil, false
}
return o.Fallback, true
}
// HasFallback returns a boolean if a field has been set.
func (o *AiReceipt) HasFallback() bool {
if o != nil && !IsNil(o.Fallback) {
return true
}
return false
}
// SetFallback gets a reference to the given string and assigns it to the Fallback field.
func (o *AiReceipt) SetFallback(v string) {
o.Fallback = &v
}
// GetPaidBy returns the PaidBy field value if set, zero value otherwise.
func (o *AiReceipt) GetPaidBy() string {
if o == nil || IsNil(o.PaidBy) {
var ret string
return ret
}
return *o.PaidBy
}
// GetPaidByOk returns a tuple with the PaidBy field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiReceipt) GetPaidByOk() (*string, bool) {
if o == nil || IsNil(o.PaidBy) {
return nil, false
}
return o.PaidBy, true
}
// HasPaidBy returns a boolean if a field has been set.
func (o *AiReceipt) HasPaidBy() bool {
if o != nil && !IsNil(o.PaidBy) {
return true
}
return false
}
// SetPaidBy gets a reference to the given string and assigns it to the PaidBy field.
func (o *AiReceipt) SetPaidBy(v string) {
o.PaidBy = &v
}
// GetReason returns the Reason field value if set, zero value otherwise.
func (o *AiReceipt) GetReason() string {
if o == nil || IsNil(o.Reason) {
var ret string
return ret
}
return *o.Reason
}
// GetReasonOk returns a tuple with the Reason field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiReceipt) GetReasonOk() (*string, bool) {
if o == nil || IsNil(o.Reason) {
return nil, false
}
return o.Reason, true
}
// HasReason returns a boolean if a field has been set.
func (o *AiReceipt) HasReason() bool {
if o != nil && !IsNil(o.Reason) {
return true
}
return false
}
// SetReason gets a reference to the given string and assigns it to the Reason field.
func (o *AiReceipt) SetReason(v string) {
o.Reason = &v
}
// GetRouted returns the Routed field value if set, zero value otherwise.
func (o *AiReceipt) GetRouted() string {
if o == nil || IsNil(o.Routed) {
var ret string
return ret
}
return *o.Routed
}
// GetRoutedOk returns a tuple with the Routed field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiReceipt) GetRoutedOk() (*string, bool) {
if o == nil || IsNil(o.Routed) {
return nil, false
}
return o.Routed, true
}
// HasRouted returns a boolean if a field has been set.
func (o *AiReceipt) HasRouted() bool {
if o != nil && !IsNil(o.Routed) {
return true
}
return false
}
// SetRouted gets a reference to the given string and assigns it to the Routed field.
func (o *AiReceipt) SetRouted(v string) {
o.Routed = &v
}
// GetServed returns the Served field value if set, zero value otherwise.
func (o *AiReceipt) GetServed() string {
if o == nil || IsNil(o.Served) {
var ret string
return ret
}
return *o.Served
}
// GetServedOk returns a tuple with the Served field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiReceipt) GetServedOk() (*string, bool) {
if o == nil || IsNil(o.Served) {
return nil, false
}
return o.Served, true
}
// HasServed returns a boolean if a field has been set.
func (o *AiReceipt) HasServed() bool {
if o != nil && !IsNil(o.Served) {
return true
}
return false
}
// SetServed gets a reference to the given string and assigns it to the Served field.
func (o *AiReceipt) SetServed(v string) {
o.Served = &v
}
// GetUsage returns the Usage field value if set, zero value otherwise.
func (o *AiReceipt) GetUsage() string {
if o == nil || IsNil(o.Usage) {
var ret string
return ret
}
return *o.Usage
}
// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiReceipt) GetUsageOk() (*string, bool) {
if o == nil || IsNil(o.Usage) {
return nil, false
}
return o.Usage, true
}
// HasUsage returns a boolean if a field has been set.
func (o *AiReceipt) HasUsage() bool {
if o != nil && !IsNil(o.Usage) {
return true
}
return false
}
// SetUsage gets a reference to the given string and assigns it to the Usage field.
func (o *AiReceipt) SetUsage(v string) {
o.Usage = &v
}
func (o AiReceipt) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o AiReceipt) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Class) {
toSerialize["class"] = o.Class
}
if !IsNil(o.Fallback) {
toSerialize["fallback"] = o.Fallback
}
if !IsNil(o.PaidBy) {
toSerialize["paid_by"] = o.PaidBy
}
if !IsNil(o.Reason) {
toSerialize["reason"] = o.Reason
}
if !IsNil(o.Routed) {
toSerialize["routed"] = o.Routed
}
if !IsNil(o.Served) {
toSerialize["served"] = o.Served
}
if !IsNil(o.Usage) {
toSerialize["usage"] = o.Usage
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *AiReceipt) UnmarshalJSON(data []byte) (err error) {
varAiReceipt := _AiReceipt{}
err = json.Unmarshal(data, &varAiReceipt)
if err != nil {
return err
}
*o = AiReceipt(varAiReceipt)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "class")
delete(additionalProperties, "fallback")
delete(additionalProperties, "paid_by")
delete(additionalProperties, "reason")
delete(additionalProperties, "routed")
delete(additionalProperties, "served")
delete(additionalProperties, "usage")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableAiReceipt struct {
value *AiReceipt
isSet bool
}
func (v NullableAiReceipt) Get() *AiReceipt {
return v.value
}
func (v *NullableAiReceipt) Set(val *AiReceipt) {
v.value = val
v.isSet = true
}
func (v NullableAiReceipt) IsSet() bool {
return v.isSet
}
func (v *NullableAiReceipt) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAiReceipt(val *AiReceipt) *NullableAiReceipt {
return &NullableAiReceipt{value: val, isSet: true}
}
func (v NullableAiReceipt) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAiReceipt) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}