Skip to content

The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.

6.8 KB
Raw Blame
/*
BoxLite

BoxLite AI platform API Docs

API version: 1.0
Contact: [email protected]
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package apiclient

import (
	"encoding/json"
	"time"
	"fmt"
)

// checks if the AdminUsageItem type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AdminUsageItem{}

// AdminUsageItem struct for AdminUsageItem
type AdminUsageItem struct {
	From time.Time `json:"from"`
	To time.Time `json:"to"`
	Dimensions AdminUsageDimensions `json:"dimensions"`
	Values AdminUsageValues `json:"values"`
	SourcePeriodCount int32 `json:"sourcePeriodCount"`
	AdditionalProperties map[string]interface{}
}

type _AdminUsageItem AdminUsageItem

// NewAdminUsageItem instantiates a new AdminUsageItem 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 NewAdminUsageItem(from time.Time, to time.Time, dimensions AdminUsageDimensions, values AdminUsageValues, sourcePeriodCount int32) *AdminUsageItem {
	this := AdminUsageItem{}
	this.From = from
	this.To = to
	this.Dimensions = dimensions
	this.Values = values
	this.SourcePeriodCount = sourcePeriodCount
	return &this
}

// NewAdminUsageItemWithDefaults instantiates a new AdminUsageItem 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 NewAdminUsageItemWithDefaults() *AdminUsageItem {
	this := AdminUsageItem{}
	return &this
}

// GetFrom returns the From field value
func (o *AdminUsageItem) GetFrom() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.From
}

// GetFromOk returns a tuple with the From field value
// and a boolean to check if the value has been set.
func (o *AdminUsageItem) GetFromOk() (*time.Time, bool) {
	if o == nil {
		return nil, false
	}
	return &o.From, true
}

// SetFrom sets field value
func (o *AdminUsageItem) SetFrom(v time.Time) {
	o.From = v
}

// GetTo returns the To field value
func (o *AdminUsageItem) GetTo() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.To
}

// GetToOk returns a tuple with the To field value
// and a boolean to check if the value has been set.
func (o *AdminUsageItem) GetToOk() (*time.Time, bool) {
	if o == nil {
		return nil, false
	}
	return &o.To, true
}

// SetTo sets field value
func (o *AdminUsageItem) SetTo(v time.Time) {
	o.To = v
}

// GetDimensions returns the Dimensions field value
func (o *AdminUsageItem) GetDimensions() AdminUsageDimensions {
	if o == nil {
		var ret AdminUsageDimensions
		return ret
	}

	return o.Dimensions
}

// GetDimensionsOk returns a tuple with the Dimensions field value
// and a boolean to check if the value has been set.
func (o *AdminUsageItem) GetDimensionsOk() (*AdminUsageDimensions, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Dimensions, true
}

// SetDimensions sets field value
func (o *AdminUsageItem) SetDimensions(v AdminUsageDimensions) {
	o.Dimensions = v
}

// GetValues returns the Values field value
func (o *AdminUsageItem) GetValues() AdminUsageValues {
	if o == nil {
		var ret AdminUsageValues
		return ret
	}

	return o.Values
}

// GetValuesOk returns a tuple with the Values field value
// and a boolean to check if the value has been set.
func (o *AdminUsageItem) GetValuesOk() (*AdminUsageValues, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Values, true
}

// SetValues sets field value
func (o *AdminUsageItem) SetValues(v AdminUsageValues) {
	o.Values = v
}

// GetSourcePeriodCount returns the SourcePeriodCount field value
func (o *AdminUsageItem) GetSourcePeriodCount() int32 {
	if o == nil {
		var ret int32
		return ret
	}

	return o.SourcePeriodCount
}

// GetSourcePeriodCountOk returns a tuple with the SourcePeriodCount field value
// and a boolean to check if the value has been set.
func (o *AdminUsageItem) GetSourcePeriodCountOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.SourcePeriodCount, true
}

// SetSourcePeriodCount sets field value
func (o *AdminUsageItem) SetSourcePeriodCount(v int32) {
	o.SourcePeriodCount = v
}

func (o AdminUsageItem) MarshalJSON() ([]byte, error) {
	toSerialize,err := o.ToMap()
	if err != nil {
		return []byte{}, err
	}
	return json.Marshal(toSerialize)
}

func (o AdminUsageItem) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["from"] = o.From
	toSerialize["to"] = o.To
	toSerialize["dimensions"] = o.Dimensions
	toSerialize["values"] = o.Values
	toSerialize["sourcePeriodCount"] = o.SourcePeriodCount

	for key, value := range o.AdditionalProperties {
		toSerialize[key] = value
	}

	return toSerialize, nil
}

func (o *AdminUsageItem) UnmarshalJSON(data []byte) (err error) {
	// This validates that all required properties are included in the JSON object
	// by unmarshalling the object into a generic map with string keys and checking
	// that every required field exists as a key in the generic map.
	requiredProperties := []string{
		"from",
		"to",
		"dimensions",
		"values",
		"sourcePeriodCount",
	}

	allProperties := make(map[string]interface{})

	err = json.Unmarshal(data, &allProperties)

	if err != nil {
		return err;
	}

	for _, requiredProperty := range(requiredProperties) {
		if _, exists := allProperties[requiredProperty]; !exists {
			return fmt.Errorf("no value given for required property %v", requiredProperty)
		}
	}

	varAdminUsageItem := _AdminUsageItem{}

	err = json.Unmarshal(data, &varAdminUsageItem)

	if err != nil {
		return err
	}

	*o = AdminUsageItem(varAdminUsageItem)

	additionalProperties := make(map[string]interface{})

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "from")
		delete(additionalProperties, "to")
		delete(additionalProperties, "dimensions")
		delete(additionalProperties, "values")
		delete(additionalProperties, "sourcePeriodCount")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableAdminUsageItem struct {
	value *AdminUsageItem
	isSet bool
}

func (v NullableAdminUsageItem) Get() *AdminUsageItem {
	return v.value
}

func (v *NullableAdminUsageItem) Set(val *AdminUsageItem) {
	v.value = val
	v.isSet = true
}

func (v NullableAdminUsageItem) IsSet() bool {
	return v.isSet
}

func (v *NullableAdminUsageItem) Unset() {
	v.value = nil
	v.isSet = false
}

func NewNullableAdminUsageItem(val *AdminUsageItem) *NullableAdminUsageItem {
	return &NullableAdminUsageItem{value: val, isSet: true}
}

func (v NullableAdminUsageItem) MarshalJSON() ([]byte, error) {
	return json.Marshal(v.value)
}

func (v *NullableAdminUsageItem) UnmarshalJSON(src []byte) error {
	v.isSet = true
	return json.Unmarshal(src, &v.value)
}