Skip to content

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

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

// BoxProgress struct for BoxProgress
type BoxProgress struct {
	// What this box is waiting on while it is being created
	Phase BoxProgressPhase `json:"phase"`
	// Suggested wait before asking about this box again, in milliseconds. A hint, not a deadline
	RetryAfterMs float32 `json:"retryAfterMs"`
	AdditionalProperties map[string]interface{}
}

type _BoxProgress BoxProgress

// NewBoxProgress instantiates a new BoxProgress 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 NewBoxProgress(phase BoxProgressPhase, retryAfterMs float32) *BoxProgress {
	this := BoxProgress{}
	this.Phase = phase
	this.RetryAfterMs = retryAfterMs
	return &this
}

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

// GetPhase returns the Phase field value
func (o *BoxProgress) GetPhase() BoxProgressPhase {
	if o == nil {
		var ret BoxProgressPhase
		return ret
	}

	return o.Phase
}

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

// SetPhase sets field value
func (o *BoxProgress) SetPhase(v BoxProgressPhase) {
	o.Phase = v
}

// GetRetryAfterMs returns the RetryAfterMs field value
func (o *BoxProgress) GetRetryAfterMs() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.RetryAfterMs
}

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

// SetRetryAfterMs sets field value
func (o *BoxProgress) SetRetryAfterMs(v float32) {
	o.RetryAfterMs = v
}

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

func (o BoxProgress) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["phase"] = o.Phase
	toSerialize["retryAfterMs"] = o.RetryAfterMs

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

	return toSerialize, nil
}

func (o *BoxProgress) 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{
		"phase",
		"retryAfterMs",
	}

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

	varBoxProgress := _BoxProgress{}

	err = json.Unmarshal(data, &varBoxProgress)

	if err != nil {
		return err
	}

	*o = BoxProgress(varBoxProgress)

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

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

	return err
}

type NullableBoxProgress struct {
	value *BoxProgress
	isSet bool
}

func (v NullableBoxProgress) Get() *BoxProgress {
	return v.value
}

func (v *NullableBoxProgress) Set(val *BoxProgress) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableBoxProgress(val *BoxProgress) *NullableBoxProgress {
	return &NullableBoxProgress{value: val, isSet: true}
}

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

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