Files
sdk/model_form_field.go

573 lines
15 KiB
Go

/*
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
API version: v1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hanzoai
import (
"encoding/json"
)
// checks if the FormField type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &FormField{}
// FormField struct for FormField
type FormField struct {
// Choices are what a multiple_choice or dropdown field offers, in order.
Choices []FormChoice `json:"choices,omitempty"`
// Description is the line under the question. At most 1000 characters.
Description *string `json:"description,omitempty"`
// ID is the field's id: assigned when a write leaves it empty, and kept across edits by sending it back.
Id *string `json:"id,omitempty"`
// Labels name the ends and middle of an opinion_scale.
Labels *FormLabels `json:"labels,omitempty"`
// Multiple is whether a multiple_choice field takes several choices.
Multiple *bool `json:"multiple,omitempty"`
// Ref is the field's stable name, how an answer and a sink name it: lowercase letters, digits, dash and underscore, at most 64, unique in the form. Defaults to the id.
Ref *string `json:"ref,omitempty"`
// Required is whether a completed response must answer it. A statement is never required.
Required *bool `json:"required,omitempty"`
// Start is where an opinion_scale begins: 0 (the default) or 1.
Start *int64 `json:"start,omitempty"`
// Steps is how many points a rating (3 to 10, default 5) or an opinion_scale (5 to 11, default 11) has.
Steps *int64 `json:"steps,omitempty"`
// Title is the question as asked. At most 500 characters.
Title *string `json:"title,omitempty"`
// Type is one of short_text, long_text, email, phone, url, number, rating, opinion_scale, yes_no, multiple_choice, dropdown, date and statement.
Type *string `json:"type,omitempty"`
// Validations bound an answer beyond its type.
Validations *FormValidations `json:"validations,omitempty"`
AdditionalProperties map[string]interface{}
}
type _FormField FormField
// NewFormField instantiates a new FormField 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 NewFormField() *FormField {
this := FormField{}
return &this
}
// NewFormFieldWithDefaults instantiates a new FormField 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 NewFormFieldWithDefaults() *FormField {
this := FormField{}
return &this
}
// GetChoices returns the Choices field value if set, zero value otherwise.
func (o *FormField) GetChoices() []FormChoice {
if o == nil || IsNil(o.Choices) {
var ret []FormChoice
return ret
}
return o.Choices
}
// GetChoicesOk returns a tuple with the Choices field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FormField) GetChoicesOk() ([]FormChoice, bool) {
if o == nil || IsNil(o.Choices) {
return nil, false
}
return o.Choices, true
}
// HasChoices returns a boolean if a field has been set.
func (o *FormField) HasChoices() bool {
if o != nil && !IsNil(o.Choices) {
return true
}
return false
}
// SetChoices gets a reference to the given []FormChoice and assigns it to the Choices field.
func (o *FormField) SetChoices(v []FormChoice) {
o.Choices = v
}
// GetDescription returns the Description field value if set, zero value otherwise.
func (o *FormField) GetDescription() string {
if o == nil || IsNil(o.Description) {
var ret string
return ret
}
return *o.Description
}
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FormField) GetDescriptionOk() (*string, bool) {
if o == nil || IsNil(o.Description) {
return nil, false
}
return o.Description, true
}
// HasDescription returns a boolean if a field has been set.
func (o *FormField) HasDescription() bool {
if o != nil && !IsNil(o.Description) {
return true
}
return false
}
// SetDescription gets a reference to the given string and assigns it to the Description field.
func (o *FormField) SetDescription(v string) {
o.Description = &v
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *FormField) GetId() string {
if o == nil || IsNil(o.Id) {
var ret string
return ret
}
return *o.Id
}
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FormField) GetIdOk() (*string, bool) {
if o == nil || IsNil(o.Id) {
return nil, false
}
return o.Id, true
}
// HasId returns a boolean if a field has been set.
func (o *FormField) HasId() bool {
if o != nil && !IsNil(o.Id) {
return true
}
return false
}
// SetId gets a reference to the given string and assigns it to the Id field.
func (o *FormField) SetId(v string) {
o.Id = &v
}
// GetLabels returns the Labels field value if set, zero value otherwise.
func (o *FormField) GetLabels() FormLabels {
if o == nil || IsNil(o.Labels) {
var ret FormLabels
return ret
}
return *o.Labels
}
// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FormField) GetLabelsOk() (*FormLabels, bool) {
if o == nil || IsNil(o.Labels) {
return nil, false
}
return o.Labels, true
}
// HasLabels returns a boolean if a field has been set.
func (o *FormField) HasLabels() bool {
if o != nil && !IsNil(o.Labels) {
return true
}
return false
}
// SetLabels gets a reference to the given FormLabels and assigns it to the Labels field.
func (o *FormField) SetLabels(v FormLabels) {
o.Labels = &v
}
// GetMultiple returns the Multiple field value if set, zero value otherwise.
func (o *FormField) GetMultiple() bool {
if o == nil || IsNil(o.Multiple) {
var ret bool
return ret
}
return *o.Multiple
}
// GetMultipleOk returns a tuple with the Multiple field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FormField) GetMultipleOk() (*bool, bool) {
if o == nil || IsNil(o.Multiple) {
return nil, false
}
return o.Multiple, true
}
// HasMultiple returns a boolean if a field has been set.
func (o *FormField) HasMultiple() bool {
if o != nil && !IsNil(o.Multiple) {
return true
}
return false
}
// SetMultiple gets a reference to the given bool and assigns it to the Multiple field.
func (o *FormField) SetMultiple(v bool) {
o.Multiple = &v
}
// GetRef returns the Ref field value if set, zero value otherwise.
func (o *FormField) GetRef() string {
if o == nil || IsNil(o.Ref) {
var ret string
return ret
}
return *o.Ref
}
// GetRefOk returns a tuple with the Ref field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FormField) GetRefOk() (*string, bool) {
if o == nil || IsNil(o.Ref) {
return nil, false
}
return o.Ref, true
}
// HasRef returns a boolean if a field has been set.
func (o *FormField) HasRef() bool {
if o != nil && !IsNil(o.Ref) {
return true
}
return false
}
// SetRef gets a reference to the given string and assigns it to the Ref field.
func (o *FormField) SetRef(v string) {
o.Ref = &v
}
// GetRequired returns the Required field value if set, zero value otherwise.
func (o *FormField) GetRequired() bool {
if o == nil || IsNil(o.Required) {
var ret bool
return ret
}
return *o.Required
}
// GetRequiredOk returns a tuple with the Required field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FormField) GetRequiredOk() (*bool, bool) {
if o == nil || IsNil(o.Required) {
return nil, false
}
return o.Required, true
}
// HasRequired returns a boolean if a field has been set.
func (o *FormField) HasRequired() bool {
if o != nil && !IsNil(o.Required) {
return true
}
return false
}
// SetRequired gets a reference to the given bool and assigns it to the Required field.
func (o *FormField) SetRequired(v bool) {
o.Required = &v
}
// GetStart returns the Start field value if set, zero value otherwise.
func (o *FormField) GetStart() int64 {
if o == nil || IsNil(o.Start) {
var ret int64
return ret
}
return *o.Start
}
// GetStartOk returns a tuple with the Start field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FormField) GetStartOk() (*int64, bool) {
if o == nil || IsNil(o.Start) {
return nil, false
}
return o.Start, true
}
// HasStart returns a boolean if a field has been set.
func (o *FormField) HasStart() bool {
if o != nil && !IsNil(o.Start) {
return true
}
return false
}
// SetStart gets a reference to the given int64 and assigns it to the Start field.
func (o *FormField) SetStart(v int64) {
o.Start = &v
}
// GetSteps returns the Steps field value if set, zero value otherwise.
func (o *FormField) GetSteps() int64 {
if o == nil || IsNil(o.Steps) {
var ret int64
return ret
}
return *o.Steps
}
// GetStepsOk returns a tuple with the Steps field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FormField) GetStepsOk() (*int64, bool) {
if o == nil || IsNil(o.Steps) {
return nil, false
}
return o.Steps, true
}
// HasSteps returns a boolean if a field has been set.
func (o *FormField) HasSteps() bool {
if o != nil && !IsNil(o.Steps) {
return true
}
return false
}
// SetSteps gets a reference to the given int64 and assigns it to the Steps field.
func (o *FormField) SetSteps(v int64) {
o.Steps = &v
}
// GetTitle returns the Title field value if set, zero value otherwise.
func (o *FormField) GetTitle() string {
if o == nil || IsNil(o.Title) {
var ret string
return ret
}
return *o.Title
}
// GetTitleOk returns a tuple with the Title field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FormField) GetTitleOk() (*string, bool) {
if o == nil || IsNil(o.Title) {
return nil, false
}
return o.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (o *FormField) HasTitle() bool {
if o != nil && !IsNil(o.Title) {
return true
}
return false
}
// SetTitle gets a reference to the given string and assigns it to the Title field.
func (o *FormField) SetTitle(v string) {
o.Title = &v
}
// GetType returns the Type field value if set, zero value otherwise.
func (o *FormField) GetType() string {
if o == nil || IsNil(o.Type) {
var ret string
return ret
}
return *o.Type
}
// GetTypeOk returns a tuple with the Type field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FormField) GetTypeOk() (*string, bool) {
if o == nil || IsNil(o.Type) {
return nil, false
}
return o.Type, true
}
// HasType returns a boolean if a field has been set.
func (o *FormField) HasType() bool {
if o != nil && !IsNil(o.Type) {
return true
}
return false
}
// SetType gets a reference to the given string and assigns it to the Type field.
func (o *FormField) SetType(v string) {
o.Type = &v
}
// GetValidations returns the Validations field value if set, zero value otherwise.
func (o *FormField) GetValidations() FormValidations {
if o == nil || IsNil(o.Validations) {
var ret FormValidations
return ret
}
return *o.Validations
}
// GetValidationsOk returns a tuple with the Validations field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FormField) GetValidationsOk() (*FormValidations, bool) {
if o == nil || IsNil(o.Validations) {
return nil, false
}
return o.Validations, true
}
// HasValidations returns a boolean if a field has been set.
func (o *FormField) HasValidations() bool {
if o != nil && !IsNil(o.Validations) {
return true
}
return false
}
// SetValidations gets a reference to the given FormValidations and assigns it to the Validations field.
func (o *FormField) SetValidations(v FormValidations) {
o.Validations = &v
}
func (o FormField) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o FormField) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Choices) {
toSerialize["choices"] = o.Choices
}
if !IsNil(o.Description) {
toSerialize["description"] = o.Description
}
if !IsNil(o.Id) {
toSerialize["id"] = o.Id
}
if !IsNil(o.Labels) {
toSerialize["labels"] = o.Labels
}
if !IsNil(o.Multiple) {
toSerialize["multiple"] = o.Multiple
}
if !IsNil(o.Ref) {
toSerialize["ref"] = o.Ref
}
if !IsNil(o.Required) {
toSerialize["required"] = o.Required
}
if !IsNil(o.Start) {
toSerialize["start"] = o.Start
}
if !IsNil(o.Steps) {
toSerialize["steps"] = o.Steps
}
if !IsNil(o.Title) {
toSerialize["title"] = o.Title
}
if !IsNil(o.Type) {
toSerialize["type"] = o.Type
}
if !IsNil(o.Validations) {
toSerialize["validations"] = o.Validations
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *FormField) UnmarshalJSON(data []byte) (err error) {
varFormField := _FormField{}
err = json.Unmarshal(data, &varFormField)
if err != nil {
return err
}
*o = FormField(varFormField)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "choices")
delete(additionalProperties, "description")
delete(additionalProperties, "id")
delete(additionalProperties, "labels")
delete(additionalProperties, "multiple")
delete(additionalProperties, "ref")
delete(additionalProperties, "required")
delete(additionalProperties, "start")
delete(additionalProperties, "steps")
delete(additionalProperties, "title")
delete(additionalProperties, "type")
delete(additionalProperties, "validations")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableFormField struct {
value *FormField
isSet bool
}
func (v NullableFormField) Get() *FormField {
return v.value
}
func (v *NullableFormField) Set(val *FormField) {
v.value = val
v.isSet = true
}
func (v NullableFormField) IsSet() bool {
return v.isSet
}
func (v *NullableFormField) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableFormField(val *FormField) *NullableFormField {
return &NullableFormField{value: val, isSet: true}
}
func (v NullableFormField) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableFormField) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}