Skip to content

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

9.6 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 AdminUsageQuery type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AdminUsageQuery{}

// AdminUsageQuery struct for AdminUsageQuery
type AdminUsageQuery struct {
	From time.Time `json:"from"`
	To time.Time `json:"to"`
	Granularity string `json:"granularity"`
	Metrics []string `json:"metrics"`
	GroupBy []string `json:"groupBy"`
	OrganizationId *string `json:"organizationId,omitempty"`
	RegionId *string `json:"regionId,omitempty"`
	BoxId *string `json:"boxId,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _AdminUsageQuery AdminUsageQuery

// NewAdminUsageQuery instantiates a new AdminUsageQuery 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 NewAdminUsageQuery(from time.Time, to time.Time, granularity string, metrics []string, groupBy []string) *AdminUsageQuery {
	this := AdminUsageQuery{}
	this.From = from
	this.To = to
	this.Granularity = granularity
	this.Metrics = metrics
	this.GroupBy = groupBy
	return &this
}

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

// GetFrom returns the From field value
func (o *AdminUsageQuery) 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 *AdminUsageQuery) GetFromOk() (*time.Time, bool) {
	if o == nil {
		return nil, false
	}
	return &o.From, true
}

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

// GetTo returns the To field value
func (o *AdminUsageQuery) 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 *AdminUsageQuery) GetToOk() (*time.Time, bool) {
	if o == nil {
		return nil, false
	}
	return &o.To, true
}

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

// GetGranularity returns the Granularity field value
func (o *AdminUsageQuery) GetGranularity() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Granularity
}

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

// SetGranularity sets field value
func (o *AdminUsageQuery) SetGranularity(v string) {
	o.Granularity = v
}

// GetMetrics returns the Metrics field value
func (o *AdminUsageQuery) GetMetrics() []string {
	if o == nil {
		var ret []string
		return ret
	}

	return o.Metrics
}

// GetMetricsOk returns a tuple with the Metrics field value
// and a boolean to check if the value has been set.
func (o *AdminUsageQuery) GetMetricsOk() ([]string, bool) {
	if o == nil {
		return nil, false
	}
	return o.Metrics, true
}

// SetMetrics sets field value
func (o *AdminUsageQuery) SetMetrics(v []string) {
	o.Metrics = v
}

// GetGroupBy returns the GroupBy field value
func (o *AdminUsageQuery) GetGroupBy() []string {
	if o == nil {
		var ret []string
		return ret
	}

	return o.GroupBy
}

// GetGroupByOk returns a tuple with the GroupBy field value
// and a boolean to check if the value has been set.
func (o *AdminUsageQuery) GetGroupByOk() ([]string, bool) {
	if o == nil {
		return nil, false
	}
	return o.GroupBy, true
}

// SetGroupBy sets field value
func (o *AdminUsageQuery) SetGroupBy(v []string) {
	o.GroupBy = v
}

// GetOrganizationId returns the OrganizationId field value if set, zero value otherwise.
func (o *AdminUsageQuery) GetOrganizationId() string {
	if o == nil || IsNil(o.OrganizationId) {
		var ret string
		return ret
	}
	return *o.OrganizationId
}

// GetOrganizationIdOk returns a tuple with the OrganizationId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AdminUsageQuery) GetOrganizationIdOk() (*string, bool) {
	if o == nil || IsNil(o.OrganizationId) {
		return nil, false
	}
	return o.OrganizationId, true
}

// HasOrganizationId returns a boolean if a field has been set.
func (o *AdminUsageQuery) HasOrganizationId() bool {
	if o != nil && !IsNil(o.OrganizationId) {
		return true
	}

	return false
}

// SetOrganizationId gets a reference to the given string and assigns it to the OrganizationId field.
func (o *AdminUsageQuery) SetOrganizationId(v string) {
	o.OrganizationId = &v
}

// GetRegionId returns the RegionId field value if set, zero value otherwise.
func (o *AdminUsageQuery) GetRegionId() string {
	if o == nil || IsNil(o.RegionId) {
		var ret string
		return ret
	}
	return *o.RegionId
}

// GetRegionIdOk returns a tuple with the RegionId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AdminUsageQuery) GetRegionIdOk() (*string, bool) {
	if o == nil || IsNil(o.RegionId) {
		return nil, false
	}
	return o.RegionId, true
}

// HasRegionId returns a boolean if a field has been set.
func (o *AdminUsageQuery) HasRegionId() bool {
	if o != nil && !IsNil(o.RegionId) {
		return true
	}

	return false
}

// SetRegionId gets a reference to the given string and assigns it to the RegionId field.
func (o *AdminUsageQuery) SetRegionId(v string) {
	o.RegionId = &v
}

// GetBoxId returns the BoxId field value if set, zero value otherwise.
func (o *AdminUsageQuery) GetBoxId() string {
	if o == nil || IsNil(o.BoxId) {
		var ret string
		return ret
	}
	return *o.BoxId
}

// GetBoxIdOk returns a tuple with the BoxId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AdminUsageQuery) GetBoxIdOk() (*string, bool) {
	if o == nil || IsNil(o.BoxId) {
		return nil, false
	}
	return o.BoxId, true
}

// HasBoxId returns a boolean if a field has been set.
func (o *AdminUsageQuery) HasBoxId() bool {
	if o != nil && !IsNil(o.BoxId) {
		return true
	}

	return false
}

// SetBoxId gets a reference to the given string and assigns it to the BoxId field.
func (o *AdminUsageQuery) SetBoxId(v string) {
	o.BoxId = &v
}

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

func (o AdminUsageQuery) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["from"] = o.From
	toSerialize["to"] = o.To
	toSerialize["granularity"] = o.Granularity
	toSerialize["metrics"] = o.Metrics
	toSerialize["groupBy"] = o.GroupBy
	if !IsNil(o.OrganizationId) {
		toSerialize["organizationId"] = o.OrganizationId
	}
	if !IsNil(o.RegionId) {
		toSerialize["regionId"] = o.RegionId
	}
	if !IsNil(o.BoxId) {
		toSerialize["boxId"] = o.BoxId
	}

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

	return toSerialize, nil
}

func (o *AdminUsageQuery) 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",
		"granularity",
		"metrics",
		"groupBy",
	}

	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)
		}
	}

	varAdminUsageQuery := _AdminUsageQuery{}

	err = json.Unmarshal(data, &varAdminUsageQuery)

	if err != nil {
		return err
	}

	*o = AdminUsageQuery(varAdminUsageQuery)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "from")
		delete(additionalProperties, "to")
		delete(additionalProperties, "granularity")
		delete(additionalProperties, "metrics")
		delete(additionalProperties, "groupBy")
		delete(additionalProperties, "organizationId")
		delete(additionalProperties, "regionId")
		delete(additionalProperties, "boxId")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableAdminUsageQuery struct {
	value *AdminUsageQuery
	isSet bool
}

func (v NullableAdminUsageQuery) Get() *AdminUsageQuery {
	return v.value
}

func (v *NullableAdminUsageQuery) Set(val *AdminUsageQuery) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableAdminUsageQuery(val *AdminUsageQuery) *NullableAdminUsageQuery {
	return &NullableAdminUsageQuery{value: val, isSet: true}
}

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

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