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

// TurnstileConfig struct for TurnstileConfig
type TurnstileConfig struct {
	// Public Turnstile widget sitekey
	Sitekey string `json:"sitekey"`
	// Turnstile challenge action
	Action string `json:"action"`
	AdditionalProperties map[string]interface{}
}

type _TurnstileConfig TurnstileConfig

// NewTurnstileConfig instantiates a new TurnstileConfig 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 NewTurnstileConfig(sitekey string, action string) *TurnstileConfig {
	this := TurnstileConfig{}
	this.Sitekey = sitekey
	this.Action = action
	return &this
}

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

// GetSitekey returns the Sitekey field value
func (o *TurnstileConfig) GetSitekey() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Sitekey
}

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

// SetSitekey sets field value
func (o *TurnstileConfig) SetSitekey(v string) {
	o.Sitekey = v
}

// GetAction returns the Action field value
func (o *TurnstileConfig) GetAction() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Action
}

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

// SetAction sets field value
func (o *TurnstileConfig) SetAction(v string) {
	o.Action = v
}

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

func (o TurnstileConfig) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["sitekey"] = o.Sitekey
	toSerialize["action"] = o.Action

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

	return toSerialize, nil
}

func (o *TurnstileConfig) 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{
		"sitekey",
		"action",
	}

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

	varTurnstileConfig := _TurnstileConfig{}

	err = json.Unmarshal(data, &varTurnstileConfig)

	if err != nil {
		return err
	}

	*o = TurnstileConfig(varTurnstileConfig)

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

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

	return err
}

type NullableTurnstileConfig struct {
	value *TurnstileConfig
	isSet bool
}

func (v NullableTurnstileConfig) Get() *TurnstileConfig {
	return v.value
}

func (v *NullableTurnstileConfig) Set(val *TurnstileConfig) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableTurnstileConfig(val *TurnstileConfig) *NullableTurnstileConfig {
	return &NullableTurnstileConfig{value: val, isSet: true}
}

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

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