Skip to content

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

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

// AdminOrganizationUsage struct for AdminOrganizationUsage
type AdminOrganizationUsage struct {
	PeriodStart time.Time `json:"periodStart"`
	PeriodEnd time.Time `json:"periodEnd"`
	// Integer encoded as a decimal string
	ComputeSeconds string `json:"computeSeconds"`
	// Integer encoded as a decimal string
	StorageByteSeconds string `json:"storageByteSeconds"`
	AdditionalProperties map[string]interface{}
}

type _AdminOrganizationUsage AdminOrganizationUsage

// NewAdminOrganizationUsage instantiates a new AdminOrganizationUsage 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 NewAdminOrganizationUsage(periodStart time.Time, periodEnd time.Time, computeSeconds string, storageByteSeconds string) *AdminOrganizationUsage {
	this := AdminOrganizationUsage{}
	this.PeriodStart = periodStart
	this.PeriodEnd = periodEnd
	this.ComputeSeconds = computeSeconds
	this.StorageByteSeconds = storageByteSeconds
	return &this
}

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

// GetPeriodStart returns the PeriodStart field value
func (o *AdminOrganizationUsage) GetPeriodStart() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.PeriodStart
}

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

// SetPeriodStart sets field value
func (o *AdminOrganizationUsage) SetPeriodStart(v time.Time) {
	o.PeriodStart = v
}

// GetPeriodEnd returns the PeriodEnd field value
func (o *AdminOrganizationUsage) GetPeriodEnd() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.PeriodEnd
}

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

// SetPeriodEnd sets field value
func (o *AdminOrganizationUsage) SetPeriodEnd(v time.Time) {
	o.PeriodEnd = v
}

// GetComputeSeconds returns the ComputeSeconds field value
func (o *AdminOrganizationUsage) GetComputeSeconds() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.ComputeSeconds
}

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

// SetComputeSeconds sets field value
func (o *AdminOrganizationUsage) SetComputeSeconds(v string) {
	o.ComputeSeconds = v
}

// GetStorageByteSeconds returns the StorageByteSeconds field value
func (o *AdminOrganizationUsage) GetStorageByteSeconds() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.StorageByteSeconds
}

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

// SetStorageByteSeconds sets field value
func (o *AdminOrganizationUsage) SetStorageByteSeconds(v string) {
	o.StorageByteSeconds = v
}

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

func (o AdminOrganizationUsage) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["periodStart"] = o.PeriodStart
	toSerialize["periodEnd"] = o.PeriodEnd
	toSerialize["computeSeconds"] = o.ComputeSeconds
	toSerialize["storageByteSeconds"] = o.StorageByteSeconds

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

	return toSerialize, nil
}

func (o *AdminOrganizationUsage) 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{
		"periodStart",
		"periodEnd",
		"computeSeconds",
		"storageByteSeconds",
	}

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

	varAdminOrganizationUsage := _AdminOrganizationUsage{}

	err = json.Unmarshal(data, &varAdminOrganizationUsage)

	if err != nil {
		return err
	}

	*o = AdminOrganizationUsage(varAdminOrganizationUsage)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "periodStart")
		delete(additionalProperties, "periodEnd")
		delete(additionalProperties, "computeSeconds")
		delete(additionalProperties, "storageByteSeconds")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableAdminOrganizationUsage struct {
	value *AdminOrganizationUsage
	isSet bool
}

func (v NullableAdminOrganizationUsage) Get() *AdminOrganizationUsage {
	return v.value
}

func (v *NullableAdminOrganizationUsage) Set(val *AdminOrganizationUsage) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableAdminOrganizationUsage(val *AdminOrganizationUsage) *NullableAdminOrganizationUsage {
	return &NullableAdminOrganizationUsage{value: val, isSet: true}
}

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

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