Files
sdk/model_form_validations.go

231 lines
6.1 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 FormValidations type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &FormValidations{}
// FormValidations struct for FormValidations
type FormValidations struct {
// MaxLength is the most characters a text answer holds, at most the platform's bound for the type.
MaxLength *int64 `json:"max_length,omitempty"`
// MaxValue is the most a number answer may be.
MaxValue *float64 `json:"max_value,omitempty"`
// MinValue is the least a number answer may be.
MinValue *float64 `json:"min_value,omitempty"`
AdditionalProperties map[string]interface{}
}
type _FormValidations FormValidations
// NewFormValidations instantiates a new FormValidations 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 NewFormValidations() *FormValidations {
this := FormValidations{}
return &this
}
// NewFormValidationsWithDefaults instantiates a new FormValidations 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 NewFormValidationsWithDefaults() *FormValidations {
this := FormValidations{}
return &this
}
// GetMaxLength returns the MaxLength field value if set, zero value otherwise.
func (o *FormValidations) GetMaxLength() int64 {
if o == nil || IsNil(o.MaxLength) {
var ret int64
return ret
}
return *o.MaxLength
}
// GetMaxLengthOk returns a tuple with the MaxLength field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FormValidations) GetMaxLengthOk() (*int64, bool) {
if o == nil || IsNil(o.MaxLength) {
return nil, false
}
return o.MaxLength, true
}
// HasMaxLength returns a boolean if a field has been set.
func (o *FormValidations) HasMaxLength() bool {
if o != nil && !IsNil(o.MaxLength) {
return true
}
return false
}
// SetMaxLength gets a reference to the given int64 and assigns it to the MaxLength field.
func (o *FormValidations) SetMaxLength(v int64) {
o.MaxLength = &v
}
// GetMaxValue returns the MaxValue field value if set, zero value otherwise.
func (o *FormValidations) GetMaxValue() float64 {
if o == nil || IsNil(o.MaxValue) {
var ret float64
return ret
}
return *o.MaxValue
}
// GetMaxValueOk returns a tuple with the MaxValue field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FormValidations) GetMaxValueOk() (*float64, bool) {
if o == nil || IsNil(o.MaxValue) {
return nil, false
}
return o.MaxValue, true
}
// HasMaxValue returns a boolean if a field has been set.
func (o *FormValidations) HasMaxValue() bool {
if o != nil && !IsNil(o.MaxValue) {
return true
}
return false
}
// SetMaxValue gets a reference to the given float64 and assigns it to the MaxValue field.
func (o *FormValidations) SetMaxValue(v float64) {
o.MaxValue = &v
}
// GetMinValue returns the MinValue field value if set, zero value otherwise.
func (o *FormValidations) GetMinValue() float64 {
if o == nil || IsNil(o.MinValue) {
var ret float64
return ret
}
return *o.MinValue
}
// GetMinValueOk returns a tuple with the MinValue field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FormValidations) GetMinValueOk() (*float64, bool) {
if o == nil || IsNil(o.MinValue) {
return nil, false
}
return o.MinValue, true
}
// HasMinValue returns a boolean if a field has been set.
func (o *FormValidations) HasMinValue() bool {
if o != nil && !IsNil(o.MinValue) {
return true
}
return false
}
// SetMinValue gets a reference to the given float64 and assigns it to the MinValue field.
func (o *FormValidations) SetMinValue(v float64) {
o.MinValue = &v
}
func (o FormValidations) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o FormValidations) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.MaxLength) {
toSerialize["max_length"] = o.MaxLength
}
if !IsNil(o.MaxValue) {
toSerialize["max_value"] = o.MaxValue
}
if !IsNil(o.MinValue) {
toSerialize["min_value"] = o.MinValue
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *FormValidations) UnmarshalJSON(data []byte) (err error) {
varFormValidations := _FormValidations{}
err = json.Unmarshal(data, &varFormValidations)
if err != nil {
return err
}
*o = FormValidations(varFormValidations)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "max_length")
delete(additionalProperties, "max_value")
delete(additionalProperties, "min_value")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableFormValidations struct {
value *FormValidations
isSet bool
}
func (v NullableFormValidations) Get() *FormValidations {
return v.value
}
func (v *NullableFormValidations) Set(val *FormValidations) {
v.value = val
v.isSet = true
}
func (v NullableFormValidations) IsSet() bool {
return v.isSet
}
func (v *NullableFormValidations) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableFormValidations(val *FormValidations) *NullableFormValidations {
return &NullableFormValidations{value: val, isSet: true}
}
func (v NullableFormValidations) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableFormValidations) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}