Skip to content

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

5.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"
	"fmt"
)

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

// AdminComponentVersionCount struct for AdminComponentVersionCount
type AdminComponentVersionCount struct {
	Version NullableString `json:"version,omitempty"`
	Count float32 `json:"count"`
	AdditionalProperties map[string]interface{}
}

type _AdminComponentVersionCount AdminComponentVersionCount

// NewAdminComponentVersionCount instantiates a new AdminComponentVersionCount 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 NewAdminComponentVersionCount(count float32) *AdminComponentVersionCount {
	this := AdminComponentVersionCount{}
	this.Count = count
	return &this
}

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

// GetVersion returns the Version field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *AdminComponentVersionCount) GetVersion() string {
	if o == nil || IsNil(o.Version.Get()) {
		var ret string
		return ret
	}
	return *o.Version.Get()
}

// GetVersionOk returns a tuple with the Version field value if set, nil otherwise
// 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 *AdminComponentVersionCount) GetVersionOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.Version.Get(), o.Version.IsSet()
}

// HasVersion returns a boolean if a field has been set.
func (o *AdminComponentVersionCount) HasVersion() bool {
	if o != nil && o.Version.IsSet() {
		return true
	}

	return false
}

// SetVersion gets a reference to the given NullableString and assigns it to the Version field.
func (o *AdminComponentVersionCount) SetVersion(v string) {
	o.Version.Set(&v)
}
// SetVersionNil sets the value for Version to be an explicit nil
func (o *AdminComponentVersionCount) SetVersionNil() {
	o.Version.Set(nil)
}

// UnsetVersion ensures that no value is present for Version, not even an explicit nil
func (o *AdminComponentVersionCount) UnsetVersion() {
	o.Version.Unset()
}

// GetCount returns the Count field value
func (o *AdminComponentVersionCount) GetCount() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.Count
}

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

// SetCount sets field value
func (o *AdminComponentVersionCount) SetCount(v float32) {
	o.Count = v
}

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

func (o AdminComponentVersionCount) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if o.Version.IsSet() {
		toSerialize["version"] = o.Version.Get()
	}
	toSerialize["count"] = o.Count

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

	return toSerialize, nil
}

func (o *AdminComponentVersionCount) 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{
		"count",
	}

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

	varAdminComponentVersionCount := _AdminComponentVersionCount{}

	err = json.Unmarshal(data, &varAdminComponentVersionCount)

	if err != nil {
		return err
	}

	*o = AdminComponentVersionCount(varAdminComponentVersionCount)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "version")
		delete(additionalProperties, "count")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableAdminComponentVersionCount struct {
	value *AdminComponentVersionCount
	isSet bool
}

func (v NullableAdminComponentVersionCount) Get() *AdminComponentVersionCount {
	return v.value
}

func (v *NullableAdminComponentVersionCount) Set(val *AdminComponentVersionCount) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableAdminComponentVersionCount(val *AdminComponentVersionCount) *NullableAdminComponentVersionCount {
	return &NullableAdminComponentVersionCount{value: val, isSet: true}
}

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

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