Skip to content

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

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

// UsageConcurrencySeriesDto struct for UsageConcurrencySeriesDto
type UsageConcurrencySeriesDto struct {
	From time.Time `json:"from"`
	To time.Time `json:"to"`
	Granularity string `json:"granularity"`
	Current int32 `json:"current"`
	Points []UsageConcurrencyPointDto `json:"points"`
	AdditionalProperties map[string]interface{}
}

type _UsageConcurrencySeriesDto UsageConcurrencySeriesDto

// NewUsageConcurrencySeriesDto instantiates a new UsageConcurrencySeriesDto 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 NewUsageConcurrencySeriesDto(from time.Time, to time.Time, granularity string, current int32, points []UsageConcurrencyPointDto) *UsageConcurrencySeriesDto {
	this := UsageConcurrencySeriesDto{}
	this.From = from
	this.To = to
	this.Granularity = granularity
	this.Current = current
	this.Points = points
	return &this
}

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

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

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

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

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

// GetGranularity returns the Granularity field value
func (o *UsageConcurrencySeriesDto) 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 *UsageConcurrencySeriesDto) GetGranularityOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Granularity, true
}

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

// GetCurrent returns the Current field value
func (o *UsageConcurrencySeriesDto) GetCurrent() int32 {
	if o == nil {
		var ret int32
		return ret
	}

	return o.Current
}

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

// SetCurrent sets field value
func (o *UsageConcurrencySeriesDto) SetCurrent(v int32) {
	o.Current = v
}

// GetPoints returns the Points field value
func (o *UsageConcurrencySeriesDto) GetPoints() []UsageConcurrencyPointDto {
	if o == nil {
		var ret []UsageConcurrencyPointDto
		return ret
	}

	return o.Points
}

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

// SetPoints sets field value
func (o *UsageConcurrencySeriesDto) SetPoints(v []UsageConcurrencyPointDto) {
	o.Points = v
}

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

func (o UsageConcurrencySeriesDto) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["from"] = o.From
	toSerialize["to"] = o.To
	toSerialize["granularity"] = o.Granularity
	toSerialize["current"] = o.Current
	toSerialize["points"] = o.Points

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

	return toSerialize, nil
}

func (o *UsageConcurrencySeriesDto) 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",
		"current",
		"points",
	}

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

	varUsageConcurrencySeriesDto := _UsageConcurrencySeriesDto{}

	err = json.Unmarshal(data, &varUsageConcurrencySeriesDto)

	if err != nil {
		return err
	}

	*o = UsageConcurrencySeriesDto(varUsageConcurrencySeriesDto)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "from")
		delete(additionalProperties, "to")
		delete(additionalProperties, "granularity")
		delete(additionalProperties, "current")
		delete(additionalProperties, "points")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableUsageConcurrencySeriesDto struct {
	value *UsageConcurrencySeriesDto
	isSet bool
}

func (v NullableUsageConcurrencySeriesDto) Get() *UsageConcurrencySeriesDto {
	return v.value
}

func (v *NullableUsageConcurrencySeriesDto) Set(val *UsageConcurrencySeriesDto) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableUsageConcurrencySeriesDto(val *UsageConcurrencySeriesDto) *NullableUsageConcurrencySeriesDto {
	return &NullableUsageConcurrencySeriesDto{value: val, isSet: true}
}

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

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