Skip to content

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

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

// AdminUsagePage struct for AdminUsagePage
type AdminUsagePage struct {
	QueryId string `json:"queryId"`
	GeneratedAt time.Time `json:"generatedAt"`
	ExpiresAt time.Time `json:"expiresAt"`
	DefinitionVersion string `json:"definitionVersion"`
	Query AdminUsageQuery `json:"query"`
	Coverage AdminUsageCoverage `json:"coverage"`
	Items []AdminUsageItem `json:"items"`
	NextCursor NullableString `json:"nextCursor"`
	AdditionalProperties map[string]interface{}
}

type _AdminUsagePage AdminUsagePage

// NewAdminUsagePage instantiates a new AdminUsagePage 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 NewAdminUsagePage(queryId string, generatedAt time.Time, expiresAt time.Time, definitionVersion string, query AdminUsageQuery, coverage AdminUsageCoverage, items []AdminUsageItem, nextCursor NullableString) *AdminUsagePage {
	this := AdminUsagePage{}
	this.QueryId = queryId
	this.GeneratedAt = generatedAt
	this.ExpiresAt = expiresAt
	this.DefinitionVersion = definitionVersion
	this.Query = query
	this.Coverage = coverage
	this.Items = items
	this.NextCursor = nextCursor
	return &this
}

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

// GetQueryId returns the QueryId field value
func (o *AdminUsagePage) GetQueryId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.QueryId
}

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

// SetQueryId sets field value
func (o *AdminUsagePage) SetQueryId(v string) {
	o.QueryId = v
}

// GetGeneratedAt returns the GeneratedAt field value
func (o *AdminUsagePage) GetGeneratedAt() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.GeneratedAt
}

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

// SetGeneratedAt sets field value
func (o *AdminUsagePage) SetGeneratedAt(v time.Time) {
	o.GeneratedAt = v
}

// GetExpiresAt returns the ExpiresAt field value
func (o *AdminUsagePage) GetExpiresAt() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.ExpiresAt
}

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

// SetExpiresAt sets field value
func (o *AdminUsagePage) SetExpiresAt(v time.Time) {
	o.ExpiresAt = v
}

// GetDefinitionVersion returns the DefinitionVersion field value
func (o *AdminUsagePage) GetDefinitionVersion() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.DefinitionVersion
}

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

// SetDefinitionVersion sets field value
func (o *AdminUsagePage) SetDefinitionVersion(v string) {
	o.DefinitionVersion = v
}

// GetQuery returns the Query field value
func (o *AdminUsagePage) GetQuery() AdminUsageQuery {
	if o == nil {
		var ret AdminUsageQuery
		return ret
	}

	return o.Query
}

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

// SetQuery sets field value
func (o *AdminUsagePage) SetQuery(v AdminUsageQuery) {
	o.Query = v
}

// GetCoverage returns the Coverage field value
func (o *AdminUsagePage) GetCoverage() AdminUsageCoverage {
	if o == nil {
		var ret AdminUsageCoverage
		return ret
	}

	return o.Coverage
}

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

// SetCoverage sets field value
func (o *AdminUsagePage) SetCoverage(v AdminUsageCoverage) {
	o.Coverage = v
}

// GetItems returns the Items field value
func (o *AdminUsagePage) GetItems() []AdminUsageItem {
	if o == nil {
		var ret []AdminUsageItem
		return ret
	}

	return o.Items
}

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

// SetItems sets field value
func (o *AdminUsagePage) SetItems(v []AdminUsageItem) {
	o.Items = v
}

// GetNextCursor returns the NextCursor field value
// If the value is explicit nil, the zero value for string will be returned
func (o *AdminUsagePage) GetNextCursor() string {
	if o == nil || o.NextCursor.Get() == nil {
		var ret string
		return ret
	}

	return *o.NextCursor.Get()
}

// GetNextCursorOk returns a tuple with the NextCursor field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *AdminUsagePage) GetNextCursorOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.NextCursor.Get(), o.NextCursor.IsSet()
}

// SetNextCursor sets field value
func (o *AdminUsagePage) SetNextCursor(v string) {
	o.NextCursor.Set(&v)
}

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

func (o AdminUsagePage) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["queryId"] = o.QueryId
	toSerialize["generatedAt"] = o.GeneratedAt
	toSerialize["expiresAt"] = o.ExpiresAt
	toSerialize["definitionVersion"] = o.DefinitionVersion
	toSerialize["query"] = o.Query
	toSerialize["coverage"] = o.Coverage
	toSerialize["items"] = o.Items
	toSerialize["nextCursor"] = o.NextCursor.Get()

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

	return toSerialize, nil
}

func (o *AdminUsagePage) 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{
		"queryId",
		"generatedAt",
		"expiresAt",
		"definitionVersion",
		"query",
		"coverage",
		"items",
		"nextCursor",
	}

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

	varAdminUsagePage := _AdminUsagePage{}

	err = json.Unmarshal(data, &varAdminUsagePage)

	if err != nil {
		return err
	}

	*o = AdminUsagePage(varAdminUsagePage)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "queryId")
		delete(additionalProperties, "generatedAt")
		delete(additionalProperties, "expiresAt")
		delete(additionalProperties, "definitionVersion")
		delete(additionalProperties, "query")
		delete(additionalProperties, "coverage")
		delete(additionalProperties, "items")
		delete(additionalProperties, "nextCursor")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableAdminUsagePage struct {
	value *AdminUsagePage
	isSet bool
}

func (v NullableAdminUsagePage) Get() *AdminUsagePage {
	return v.value
}

func (v *NullableAdminUsagePage) Set(val *AdminUsagePage) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableAdminUsagePage(val *AdminUsagePage) *NullableAdminUsagePage {
	return &NullableAdminUsagePage{value: val, isSet: true}
}

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

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