Skip to content

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

2.9 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"
)

// WebhookEvent The type of event being sent
type WebhookEvent string

// List of WebhookEvent
const (
	WEBHOOKEVENT_BOX_CREATED WebhookEvent = "box.created"
	WEBHOOKEVENT_BOX_STATE_UPDATED WebhookEvent = "box.state.updated"
	WEBHOOKEVENT_TEMPLATE_CREATED WebhookEvent = "template.created"
	WEBHOOKEVENT_TEMPLATE_STATE_UPDATED WebhookEvent = "template.state.updated"
	WEBHOOKEVENT_TEMPLATE_REMOVED WebhookEvent = "template.removed"
	WEBHOOKEVENT_VOLUME_CREATED WebhookEvent = "volume.created"
	WEBHOOKEVENT_VOLUME_STATE_UPDATED WebhookEvent = "volume.state.updated"
	WEBHOOKEVENT_UNKNOWN_DEFAULT_OPEN_API WebhookEvent = "unknown_default_open_api"
)

// All allowed values of WebhookEvent enum
var AllowedWebhookEventEnumValues = []WebhookEvent{
	"box.created",
	"box.state.updated",
	"template.created",
	"template.state.updated",
	"template.removed",
	"volume.created",
	"volume.state.updated",
	"unknown_default_open_api",
}

func (v *WebhookEvent) UnmarshalJSON(src []byte) error {
	var value string
	err := json.Unmarshal(src, &value)
	if err != nil {
		return err
	}
	enumTypeValue := WebhookEvent(value)
	for _, existing := range AllowedWebhookEventEnumValues {
		if existing == enumTypeValue {
			*v = enumTypeValue
			return nil
		}
	}

	*v = WEBHOOKEVENT_UNKNOWN_DEFAULT_OPEN_API
	return nil
}

// NewWebhookEventFromValue returns a pointer to a valid WebhookEvent
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewWebhookEventFromValue(v string) (*WebhookEvent, error) {
	ev := WebhookEvent(v)
	if ev.IsValid() {
		return &ev, nil
	} else {
		enumValue := WEBHOOKEVENT_UNKNOWN_DEFAULT_OPEN_API
		return &enumValue, nil
	}
}

// IsValid return true if the value is valid for the enum, false otherwise
func (v WebhookEvent) IsValid() bool {
	for _, existing := range AllowedWebhookEventEnumValues {
		if existing == v {
			return true
		}
	}
	return false
}

// Ptr returns reference to WebhookEvent value
func (v WebhookEvent) Ptr() *WebhookEvent {
	return &v
}

type NullableWebhookEvent struct {
	value *WebhookEvent
	isSet bool
}

func (v NullableWebhookEvent) Get() *WebhookEvent {
	return v.value
}

func (v *NullableWebhookEvent) Set(val *WebhookEvent) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableWebhookEvent(val *WebhookEvent) *NullableWebhookEvent {
	return &NullableWebhookEvent{value: val, isSet: true}
}

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

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