mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
459 lines
13 KiB
Go
459 lines
13 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 AllowanceAllowance type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &AllowanceAllowance{}
|
|
|
|
// AllowanceAllowance struct for AllowanceAllowance
|
|
type AllowanceAllowance struct {
|
|
// calls the plan allows in Window; 0 = unbounded
|
|
Limit *int64 `json:"limit,omitempty"`
|
|
// the tier the limit came from
|
|
Plan *string `json:"plan,omitempty"`
|
|
// Pool is that shared pool's standing, where it could be read. Absent when the subject is not pooled, and when the process that holds it did not answer — never a guess.
|
|
Pool *AllowancePool `json:"pool,omitempty"`
|
|
// Pooled says the calls counted here are served from the pool every free user shares — the platform's vendor accounts for free models — rather than from the subject's own plan. True exactly where a window bounds the subject.
|
|
Pooled *bool `json:"pooled,omitempty"`
|
|
// Resets is the instant THAT window reopens, unix seconds: the next UTC hour or midnight, or a session's start plus its length — exact, to the second, from the call that opened it. 0 for a session that is not running: it opens at the next call.
|
|
Resets *int64 `json:"resets,omitempty"`
|
|
// Spent says the ceiling refuses: on a take, that THIS call was refused and nothing was counted; on a read, that the next call would be.
|
|
Spent *bool `json:"spent,omitempty"`
|
|
// Start is when the session this answer counts in opened, unix seconds: on a take, the session the call was counted in, which a give names back (AllowanceIn.Start); on a read, the session running. 0 where no session bounds the subject or none runs.
|
|
Start *int64 `json:"start,omitempty"`
|
|
// Used is how many free calls this subject has been admitted in the window ending at Resets. A call counts when it is admitted, whatever its upstream then does; a refused call counts nothing. It stops AT Limit rather than climbing past it, so Limit-Used is what remains and never goes negative.
|
|
Used *int64 `json:"used,omitempty"`
|
|
// Window is which ceiling these numbers describe — \"hour\", \"session\" or \"day\" — because a caller can be held to more than one and only one of them is the answer. A session is the Free plan's: it opens at the subject's first call after the last one ended and runs five hours (ai_plan_session_hours). It is the window that REFUSED where one did, and otherwise the one with least left, so Limit-Used is always the number that will actually stop them next. Empty where no window bounds the subject at all.
|
|
Window *string `json:"window,omitempty"`
|
|
AdditionalProperties map[string]interface{}
|
|
}
|
|
|
|
type _AllowanceAllowance AllowanceAllowance
|
|
|
|
// NewAllowanceAllowance instantiates a new AllowanceAllowance 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 NewAllowanceAllowance() *AllowanceAllowance {
|
|
this := AllowanceAllowance{}
|
|
return &this
|
|
}
|
|
|
|
// NewAllowanceAllowanceWithDefaults instantiates a new AllowanceAllowance 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 NewAllowanceAllowanceWithDefaults() *AllowanceAllowance {
|
|
this := AllowanceAllowance{}
|
|
return &this
|
|
}
|
|
|
|
// GetLimit returns the Limit field value if set, zero value otherwise.
|
|
func (o *AllowanceAllowance) GetLimit() int64 {
|
|
if o == nil || IsNil(o.Limit) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.Limit
|
|
}
|
|
|
|
// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *AllowanceAllowance) GetLimitOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.Limit) {
|
|
return nil, false
|
|
}
|
|
return o.Limit, true
|
|
}
|
|
|
|
// HasLimit returns a boolean if a field has been set.
|
|
func (o *AllowanceAllowance) HasLimit() bool {
|
|
if o != nil && !IsNil(o.Limit) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetLimit gets a reference to the given int64 and assigns it to the Limit field.
|
|
func (o *AllowanceAllowance) SetLimit(v int64) {
|
|
o.Limit = &v
|
|
}
|
|
|
|
// GetPlan returns the Plan field value if set, zero value otherwise.
|
|
func (o *AllowanceAllowance) GetPlan() string {
|
|
if o == nil || IsNil(o.Plan) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Plan
|
|
}
|
|
|
|
// GetPlanOk returns a tuple with the Plan field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *AllowanceAllowance) GetPlanOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Plan) {
|
|
return nil, false
|
|
}
|
|
return o.Plan, true
|
|
}
|
|
|
|
// HasPlan returns a boolean if a field has been set.
|
|
func (o *AllowanceAllowance) HasPlan() bool {
|
|
if o != nil && !IsNil(o.Plan) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetPlan gets a reference to the given string and assigns it to the Plan field.
|
|
func (o *AllowanceAllowance) SetPlan(v string) {
|
|
o.Plan = &v
|
|
}
|
|
|
|
// GetPool returns the Pool field value if set, zero value otherwise.
|
|
func (o *AllowanceAllowance) GetPool() AllowancePool {
|
|
if o == nil || IsNil(o.Pool) {
|
|
var ret AllowancePool
|
|
return ret
|
|
}
|
|
return *o.Pool
|
|
}
|
|
|
|
// GetPoolOk returns a tuple with the Pool field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *AllowanceAllowance) GetPoolOk() (*AllowancePool, bool) {
|
|
if o == nil || IsNil(o.Pool) {
|
|
return nil, false
|
|
}
|
|
return o.Pool, true
|
|
}
|
|
|
|
// HasPool returns a boolean if a field has been set.
|
|
func (o *AllowanceAllowance) HasPool() bool {
|
|
if o != nil && !IsNil(o.Pool) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetPool gets a reference to the given AllowancePool and assigns it to the Pool field.
|
|
func (o *AllowanceAllowance) SetPool(v AllowancePool) {
|
|
o.Pool = &v
|
|
}
|
|
|
|
// GetPooled returns the Pooled field value if set, zero value otherwise.
|
|
func (o *AllowanceAllowance) GetPooled() bool {
|
|
if o == nil || IsNil(o.Pooled) {
|
|
var ret bool
|
|
return ret
|
|
}
|
|
return *o.Pooled
|
|
}
|
|
|
|
// GetPooledOk returns a tuple with the Pooled field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *AllowanceAllowance) GetPooledOk() (*bool, bool) {
|
|
if o == nil || IsNil(o.Pooled) {
|
|
return nil, false
|
|
}
|
|
return o.Pooled, true
|
|
}
|
|
|
|
// HasPooled returns a boolean if a field has been set.
|
|
func (o *AllowanceAllowance) HasPooled() bool {
|
|
if o != nil && !IsNil(o.Pooled) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetPooled gets a reference to the given bool and assigns it to the Pooled field.
|
|
func (o *AllowanceAllowance) SetPooled(v bool) {
|
|
o.Pooled = &v
|
|
}
|
|
|
|
// GetResets returns the Resets field value if set, zero value otherwise.
|
|
func (o *AllowanceAllowance) GetResets() int64 {
|
|
if o == nil || IsNil(o.Resets) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.Resets
|
|
}
|
|
|
|
// GetResetsOk returns a tuple with the Resets field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *AllowanceAllowance) GetResetsOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.Resets) {
|
|
return nil, false
|
|
}
|
|
return o.Resets, true
|
|
}
|
|
|
|
// HasResets returns a boolean if a field has been set.
|
|
func (o *AllowanceAllowance) HasResets() bool {
|
|
if o != nil && !IsNil(o.Resets) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetResets gets a reference to the given int64 and assigns it to the Resets field.
|
|
func (o *AllowanceAllowance) SetResets(v int64) {
|
|
o.Resets = &v
|
|
}
|
|
|
|
// GetSpent returns the Spent field value if set, zero value otherwise.
|
|
func (o *AllowanceAllowance) GetSpent() bool {
|
|
if o == nil || IsNil(o.Spent) {
|
|
var ret bool
|
|
return ret
|
|
}
|
|
return *o.Spent
|
|
}
|
|
|
|
// GetSpentOk returns a tuple with the Spent field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *AllowanceAllowance) GetSpentOk() (*bool, bool) {
|
|
if o == nil || IsNil(o.Spent) {
|
|
return nil, false
|
|
}
|
|
return o.Spent, true
|
|
}
|
|
|
|
// HasSpent returns a boolean if a field has been set.
|
|
func (o *AllowanceAllowance) HasSpent() bool {
|
|
if o != nil && !IsNil(o.Spent) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetSpent gets a reference to the given bool and assigns it to the Spent field.
|
|
func (o *AllowanceAllowance) SetSpent(v bool) {
|
|
o.Spent = &v
|
|
}
|
|
|
|
// GetStart returns the Start field value if set, zero value otherwise.
|
|
func (o *AllowanceAllowance) GetStart() int64 {
|
|
if o == nil || IsNil(o.Start) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.Start
|
|
}
|
|
|
|
// GetStartOk returns a tuple with the Start field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *AllowanceAllowance) GetStartOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.Start) {
|
|
return nil, false
|
|
}
|
|
return o.Start, true
|
|
}
|
|
|
|
// HasStart returns a boolean if a field has been set.
|
|
func (o *AllowanceAllowance) HasStart() bool {
|
|
if o != nil && !IsNil(o.Start) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetStart gets a reference to the given int64 and assigns it to the Start field.
|
|
func (o *AllowanceAllowance) SetStart(v int64) {
|
|
o.Start = &v
|
|
}
|
|
|
|
// GetUsed returns the Used field value if set, zero value otherwise.
|
|
func (o *AllowanceAllowance) GetUsed() int64 {
|
|
if o == nil || IsNil(o.Used) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.Used
|
|
}
|
|
|
|
// GetUsedOk returns a tuple with the Used field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *AllowanceAllowance) GetUsedOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.Used) {
|
|
return nil, false
|
|
}
|
|
return o.Used, true
|
|
}
|
|
|
|
// HasUsed returns a boolean if a field has been set.
|
|
func (o *AllowanceAllowance) HasUsed() bool {
|
|
if o != nil && !IsNil(o.Used) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetUsed gets a reference to the given int64 and assigns it to the Used field.
|
|
func (o *AllowanceAllowance) SetUsed(v int64) {
|
|
o.Used = &v
|
|
}
|
|
|
|
// GetWindow returns the Window field value if set, zero value otherwise.
|
|
func (o *AllowanceAllowance) GetWindow() string {
|
|
if o == nil || IsNil(o.Window) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Window
|
|
}
|
|
|
|
// GetWindowOk returns a tuple with the Window field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *AllowanceAllowance) GetWindowOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Window) {
|
|
return nil, false
|
|
}
|
|
return o.Window, true
|
|
}
|
|
|
|
// HasWindow returns a boolean if a field has been set.
|
|
func (o *AllowanceAllowance) HasWindow() bool {
|
|
if o != nil && !IsNil(o.Window) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetWindow gets a reference to the given string and assigns it to the Window field.
|
|
func (o *AllowanceAllowance) SetWindow(v string) {
|
|
o.Window = &v
|
|
}
|
|
|
|
func (o AllowanceAllowance) MarshalJSON() ([]byte, error) {
|
|
toSerialize, err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o AllowanceAllowance) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if !IsNil(o.Limit) {
|
|
toSerialize["limit"] = o.Limit
|
|
}
|
|
if !IsNil(o.Plan) {
|
|
toSerialize["plan"] = o.Plan
|
|
}
|
|
if !IsNil(o.Pool) {
|
|
toSerialize["pool"] = o.Pool
|
|
}
|
|
if !IsNil(o.Pooled) {
|
|
toSerialize["pooled"] = o.Pooled
|
|
}
|
|
if !IsNil(o.Resets) {
|
|
toSerialize["resets"] = o.Resets
|
|
}
|
|
if !IsNil(o.Spent) {
|
|
toSerialize["spent"] = o.Spent
|
|
}
|
|
if !IsNil(o.Start) {
|
|
toSerialize["start"] = o.Start
|
|
}
|
|
if !IsNil(o.Used) {
|
|
toSerialize["used"] = o.Used
|
|
}
|
|
if !IsNil(o.Window) {
|
|
toSerialize["window"] = o.Window
|
|
}
|
|
|
|
for key, value := range o.AdditionalProperties {
|
|
toSerialize[key] = value
|
|
}
|
|
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *AllowanceAllowance) UnmarshalJSON(data []byte) (err error) {
|
|
varAllowanceAllowance := _AllowanceAllowance{}
|
|
|
|
err = json.Unmarshal(data, &varAllowanceAllowance)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = AllowanceAllowance(varAllowanceAllowance)
|
|
|
|
additionalProperties := make(map[string]interface{})
|
|
|
|
if err = json.Unmarshal(data, &additionalProperties); err == nil {
|
|
delete(additionalProperties, "limit")
|
|
delete(additionalProperties, "plan")
|
|
delete(additionalProperties, "pool")
|
|
delete(additionalProperties, "pooled")
|
|
delete(additionalProperties, "resets")
|
|
delete(additionalProperties, "spent")
|
|
delete(additionalProperties, "start")
|
|
delete(additionalProperties, "used")
|
|
delete(additionalProperties, "window")
|
|
o.AdditionalProperties = additionalProperties
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
type NullableAllowanceAllowance struct {
|
|
value *AllowanceAllowance
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableAllowanceAllowance) Get() *AllowanceAllowance {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableAllowanceAllowance) Set(val *AllowanceAllowance) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableAllowanceAllowance) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableAllowanceAllowance) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableAllowanceAllowance(val *AllowanceAllowance) *NullableAllowanceAllowance {
|
|
return &NullableAllowanceAllowance{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableAllowanceAllowance) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableAllowanceAllowance) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|