Files
sdk/model_usage_sources.go

193 lines
4.9 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 UsageSources type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &UsageSources{}
// UsageSources struct for UsageSources
type UsageSources struct {
// Commerce is whether the billing ledger answered the spend block.
Commerce *bool `json:"commerce,omitempty"`
// Warehouse is whether the usage warehouse answered the LLM block.
Warehouse *bool `json:"warehouse,omitempty"`
AdditionalProperties map[string]interface{}
}
type _UsageSources UsageSources
// NewUsageSources instantiates a new UsageSources 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 NewUsageSources() *UsageSources {
this := UsageSources{}
return &this
}
// NewUsageSourcesWithDefaults instantiates a new UsageSources 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 NewUsageSourcesWithDefaults() *UsageSources {
this := UsageSources{}
return &this
}
// GetCommerce returns the Commerce field value if set, zero value otherwise.
func (o *UsageSources) GetCommerce() bool {
if o == nil || IsNil(o.Commerce) {
var ret bool
return ret
}
return *o.Commerce
}
// GetCommerceOk returns a tuple with the Commerce field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageSources) GetCommerceOk() (*bool, bool) {
if o == nil || IsNil(o.Commerce) {
return nil, false
}
return o.Commerce, true
}
// HasCommerce returns a boolean if a field has been set.
func (o *UsageSources) HasCommerce() bool {
if o != nil && !IsNil(o.Commerce) {
return true
}
return false
}
// SetCommerce gets a reference to the given bool and assigns it to the Commerce field.
func (o *UsageSources) SetCommerce(v bool) {
o.Commerce = &v
}
// GetWarehouse returns the Warehouse field value if set, zero value otherwise.
func (o *UsageSources) GetWarehouse() bool {
if o == nil || IsNil(o.Warehouse) {
var ret bool
return ret
}
return *o.Warehouse
}
// GetWarehouseOk returns a tuple with the Warehouse field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageSources) GetWarehouseOk() (*bool, bool) {
if o == nil || IsNil(o.Warehouse) {
return nil, false
}
return o.Warehouse, true
}
// HasWarehouse returns a boolean if a field has been set.
func (o *UsageSources) HasWarehouse() bool {
if o != nil && !IsNil(o.Warehouse) {
return true
}
return false
}
// SetWarehouse gets a reference to the given bool and assigns it to the Warehouse field.
func (o *UsageSources) SetWarehouse(v bool) {
o.Warehouse = &v
}
func (o UsageSources) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o UsageSources) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Commerce) {
toSerialize["commerce"] = o.Commerce
}
if !IsNil(o.Warehouse) {
toSerialize["warehouse"] = o.Warehouse
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *UsageSources) UnmarshalJSON(data []byte) (err error) {
varUsageSources := _UsageSources{}
err = json.Unmarshal(data, &varUsageSources)
if err != nil {
return err
}
*o = UsageSources(varUsageSources)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "commerce")
delete(additionalProperties, "warehouse")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableUsageSources struct {
value *UsageSources
isSet bool
}
func (v NullableUsageSources) Get() *UsageSources {
return v.value
}
func (v *NullableUsageSources) Set(val *UsageSources) {
v.value = val
v.isSet = true
}
func (v NullableUsageSources) IsSet() bool {
return v.isSet
}
func (v *NullableUsageSources) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableUsageSources(val *UsageSources) *NullableUsageSources {
return &NullableUsageSources{value: val, isSet: true}
}
func (v NullableUsageSources) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableUsageSources) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}