Files
sdk/model_ai_window.go

231 lines
5.7 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 AiWindow type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AiWindow{}
// AiWindow struct for AiWindow
type AiWindow struct {
// Percent is the share used, 0 to 100, rounded up to the next five so any use shows.
Percent *int64 `json:"percent,omitempty"`
// ResetsAt is when the window starts again (RFC3339), null for a session that is not running: it starts at the next request.
ResetsAt *string `json:"resets_at,omitempty"`
// State is ok, near (four fifths used) or limited (used up).
State *string `json:"state,omitempty"`
AdditionalProperties map[string]interface{}
}
type _AiWindow AiWindow
// NewAiWindow instantiates a new AiWindow 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 NewAiWindow() *AiWindow {
this := AiWindow{}
return &this
}
// NewAiWindowWithDefaults instantiates a new AiWindow 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 NewAiWindowWithDefaults() *AiWindow {
this := AiWindow{}
return &this
}
// GetPercent returns the Percent field value if set, zero value otherwise.
func (o *AiWindow) GetPercent() int64 {
if o == nil || IsNil(o.Percent) {
var ret int64
return ret
}
return *o.Percent
}
// GetPercentOk returns a tuple with the Percent field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiWindow) GetPercentOk() (*int64, bool) {
if o == nil || IsNil(o.Percent) {
return nil, false
}
return o.Percent, true
}
// HasPercent returns a boolean if a field has been set.
func (o *AiWindow) HasPercent() bool {
if o != nil && !IsNil(o.Percent) {
return true
}
return false
}
// SetPercent gets a reference to the given int64 and assigns it to the Percent field.
func (o *AiWindow) SetPercent(v int64) {
o.Percent = &v
}
// GetResetsAt returns the ResetsAt field value if set, zero value otherwise.
func (o *AiWindow) GetResetsAt() string {
if o == nil || IsNil(o.ResetsAt) {
var ret string
return ret
}
return *o.ResetsAt
}
// GetResetsAtOk returns a tuple with the ResetsAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiWindow) GetResetsAtOk() (*string, bool) {
if o == nil || IsNil(o.ResetsAt) {
return nil, false
}
return o.ResetsAt, true
}
// HasResetsAt returns a boolean if a field has been set.
func (o *AiWindow) HasResetsAt() bool {
if o != nil && !IsNil(o.ResetsAt) {
return true
}
return false
}
// SetResetsAt gets a reference to the given string and assigns it to the ResetsAt field.
func (o *AiWindow) SetResetsAt(v string) {
o.ResetsAt = &v
}
// GetState returns the State field value if set, zero value otherwise.
func (o *AiWindow) GetState() string {
if o == nil || IsNil(o.State) {
var ret string
return ret
}
return *o.State
}
// GetStateOk returns a tuple with the State field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AiWindow) GetStateOk() (*string, bool) {
if o == nil || IsNil(o.State) {
return nil, false
}
return o.State, true
}
// HasState returns a boolean if a field has been set.
func (o *AiWindow) HasState() bool {
if o != nil && !IsNil(o.State) {
return true
}
return false
}
// SetState gets a reference to the given string and assigns it to the State field.
func (o *AiWindow) SetState(v string) {
o.State = &v
}
func (o AiWindow) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o AiWindow) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Percent) {
toSerialize["percent"] = o.Percent
}
if !IsNil(o.ResetsAt) {
toSerialize["resets_at"] = o.ResetsAt
}
if !IsNil(o.State) {
toSerialize["state"] = o.State
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *AiWindow) UnmarshalJSON(data []byte) (err error) {
varAiWindow := _AiWindow{}
err = json.Unmarshal(data, &varAiWindow)
if err != nil {
return err
}
*o = AiWindow(varAiWindow)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "percent")
delete(additionalProperties, "resets_at")
delete(additionalProperties, "state")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableAiWindow struct {
value *AiWindow
isSet bool
}
func (v NullableAiWindow) Get() *AiWindow {
return v.value
}
func (v *NullableAiWindow) Set(val *AiWindow) {
v.value = val
v.isSet = true
}
func (v NullableAiWindow) IsSet() bool {
return v.isSet
}
func (v *NullableAiWindow) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAiWindow(val *AiWindow) *NullableAiWindow {
return &NullableAiWindow{value: val, isSet: true}
}
func (v NullableAiWindow) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAiWindow) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}