Skip to content

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

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

// AttachTicket struct for AttachTicket
type AttachTicket struct {
	// Single-use credential for the attach WebSocket, sent as its `ticket` query parameter
	Ticket string `json:"ticket"`
	// Seconds until the ticket expires
	ExpiresIn float32 `json:"expiresIn"`
	AdditionalProperties map[string]interface{}
}

type _AttachTicket AttachTicket

// NewAttachTicket instantiates a new AttachTicket 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 NewAttachTicket(ticket string, expiresIn float32) *AttachTicket {
	this := AttachTicket{}
	this.Ticket = ticket
	this.ExpiresIn = expiresIn
	return &this
}

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

// GetTicket returns the Ticket field value
func (o *AttachTicket) GetTicket() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Ticket
}

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

// SetTicket sets field value
func (o *AttachTicket) SetTicket(v string) {
	o.Ticket = v
}

// GetExpiresIn returns the ExpiresIn field value
func (o *AttachTicket) GetExpiresIn() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.ExpiresIn
}

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

// SetExpiresIn sets field value
func (o *AttachTicket) SetExpiresIn(v float32) {
	o.ExpiresIn = v
}

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

func (o AttachTicket) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["ticket"] = o.Ticket
	toSerialize["expiresIn"] = o.ExpiresIn

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

	return toSerialize, nil
}

func (o *AttachTicket) 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{
		"ticket",
		"expiresIn",
	}

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

	varAttachTicket := _AttachTicket{}

	err = json.Unmarshal(data, &varAttachTicket)

	if err != nil {
		return err
	}

	*o = AttachTicket(varAttachTicket)

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

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

	return err
}

type NullableAttachTicket struct {
	value *AttachTicket
	isSet bool
}

func (v NullableAttachTicket) Get() *AttachTicket {
	return v.value
}

func (v *NullableAttachTicket) Set(val *AttachTicket) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableAttachTicket(val *AttachTicket) *NullableAttachTicket {
	return &NullableAttachTicket{value: val, isSet: true}
}

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

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