Skip to content

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

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

// CreateRegionResponse struct for CreateRegionResponse
type CreateRegionResponse struct {
	// ID of the created region
	Id string `json:"id"`
	// Proxy API key for the region
	ProxyApiKey NullableString `json:"proxyApiKey,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _CreateRegionResponse CreateRegionResponse

// NewCreateRegionResponse instantiates a new CreateRegionResponse 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 NewCreateRegionResponse(id string) *CreateRegionResponse {
	this := CreateRegionResponse{}
	this.Id = id
	return &this
}

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

// GetId returns the Id field value
func (o *CreateRegionResponse) GetId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Id
}

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

// SetId sets field value
func (o *CreateRegionResponse) SetId(v string) {
	o.Id = v
}

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

// GetProxyApiKeyOk returns a tuple with the ProxyApiKey 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 *CreateRegionResponse) GetProxyApiKeyOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.ProxyApiKey.Get(), o.ProxyApiKey.IsSet()
}

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

	return false
}

// SetProxyApiKey gets a reference to the given NullableString and assigns it to the ProxyApiKey field.
func (o *CreateRegionResponse) SetProxyApiKey(v string) {
	o.ProxyApiKey.Set(&v)
}
// SetProxyApiKeyNil sets the value for ProxyApiKey to be an explicit nil
func (o *CreateRegionResponse) SetProxyApiKeyNil() {
	o.ProxyApiKey.Set(nil)
}

// UnsetProxyApiKey ensures that no value is present for ProxyApiKey, not even an explicit nil
func (o *CreateRegionResponse) UnsetProxyApiKey() {
	o.ProxyApiKey.Unset()
}

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

func (o CreateRegionResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["id"] = o.Id
	if o.ProxyApiKey.IsSet() {
		toSerialize["proxyApiKey"] = o.ProxyApiKey.Get()
	}

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

	return toSerialize, nil
}

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

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

	varCreateRegionResponse := _CreateRegionResponse{}

	err = json.Unmarshal(data, &varCreateRegionResponse)

	if err != nil {
		return err
	}

	*o = CreateRegionResponse(varCreateRegionResponse)

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

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

	return err
}

type NullableCreateRegionResponse struct {
	value *CreateRegionResponse
	isSet bool
}

func (v NullableCreateRegionResponse) Get() *CreateRegionResponse {
	return v.value
}

func (v *NullableCreateRegionResponse) Set(val *CreateRegionResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableCreateRegionResponse(val *CreateRegionResponse) *NullableCreateRegionResponse {
	return &NullableCreateRegionResponse{value: val, isSet: true}
}

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

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