bunnyshell.com/sdk@v0.16.0/model_float_value_item.go (about)

     1  /*
     2  API Bunnyshell Environments
     3  
     4  Interact with Bunnyshell Platform
     5  
     6  API version: 1.1.0
     7  Contact: osi+support@bunnyshell.com
     8  */
     9  
    10  // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
    11  
    12  package sdk
    13  
    14  import (
    15  	"encoding/json"
    16  )
    17  
    18  // checks if the FloatValueItem type satisfies the MappedNullable interface at compile time
    19  var _ MappedNullable = &FloatValueItem{}
    20  
    21  // FloatValueItem struct for FloatValueItem
    22  type FloatValueItem struct {
    23  	Value *float32 `json:"value,omitempty"`
    24  	Type  *string  `json:"type,omitempty"`
    25  }
    26  
    27  // NewFloatValueItem instantiates a new FloatValueItem object
    28  // This constructor will assign default values to properties that have it defined,
    29  // and makes sure properties required by API are set, but the set of arguments
    30  // will change when the set of required properties is changed
    31  func NewFloatValueItem() *FloatValueItem {
    32  	this := FloatValueItem{}
    33  	return &this
    34  }
    35  
    36  // NewFloatValueItemWithDefaults instantiates a new FloatValueItem object
    37  // This constructor will only assign default values to properties that have it defined,
    38  // but it doesn't guarantee that properties required by API are set
    39  func NewFloatValueItemWithDefaults() *FloatValueItem {
    40  	this := FloatValueItem{}
    41  	return &this
    42  }
    43  
    44  // GetValue returns the Value field value if set, zero value otherwise.
    45  func (o *FloatValueItem) GetValue() float32 {
    46  	if o == nil || IsNil(o.Value) {
    47  		var ret float32
    48  		return ret
    49  	}
    50  	return *o.Value
    51  }
    52  
    53  // GetValueOk returns a tuple with the Value field value if set, nil otherwise
    54  // and a boolean to check if the value has been set.
    55  func (o *FloatValueItem) GetValueOk() (*float32, bool) {
    56  	if o == nil || IsNil(o.Value) {
    57  		return nil, false
    58  	}
    59  	return o.Value, true
    60  }
    61  
    62  // HasValue returns a boolean if a field has been set.
    63  func (o *FloatValueItem) HasValue() bool {
    64  	if o != nil && !IsNil(o.Value) {
    65  		return true
    66  	}
    67  
    68  	return false
    69  }
    70  
    71  // SetValue gets a reference to the given float32 and assigns it to the Value field.
    72  func (o *FloatValueItem) SetValue(v float32) {
    73  	o.Value = &v
    74  }
    75  
    76  // GetType returns the Type field value if set, zero value otherwise.
    77  func (o *FloatValueItem) GetType() string {
    78  	if o == nil || IsNil(o.Type) {
    79  		var ret string
    80  		return ret
    81  	}
    82  	return *o.Type
    83  }
    84  
    85  // GetTypeOk returns a tuple with the Type field value if set, nil otherwise
    86  // and a boolean to check if the value has been set.
    87  func (o *FloatValueItem) GetTypeOk() (*string, bool) {
    88  	if o == nil || IsNil(o.Type) {
    89  		return nil, false
    90  	}
    91  	return o.Type, true
    92  }
    93  
    94  // HasType returns a boolean if a field has been set.
    95  func (o *FloatValueItem) HasType() bool {
    96  	if o != nil && !IsNil(o.Type) {
    97  		return true
    98  	}
    99  
   100  	return false
   101  }
   102  
   103  // SetType gets a reference to the given string and assigns it to the Type field.
   104  func (o *FloatValueItem) SetType(v string) {
   105  	o.Type = &v
   106  }
   107  
   108  func (o FloatValueItem) MarshalJSON() ([]byte, error) {
   109  	toSerialize, err := o.ToMap()
   110  	if err != nil {
   111  		return []byte{}, err
   112  	}
   113  	return json.Marshal(toSerialize)
   114  }
   115  
   116  func (o FloatValueItem) ToMap() (map[string]interface{}, error) {
   117  	toSerialize := map[string]interface{}{}
   118  	if !IsNil(o.Value) {
   119  		toSerialize["value"] = o.Value
   120  	}
   121  	if !IsNil(o.Type) {
   122  		toSerialize["type"] = o.Type
   123  	}
   124  	return toSerialize, nil
   125  }
   126  
   127  type NullableFloatValueItem struct {
   128  	value *FloatValueItem
   129  	isSet bool
   130  }
   131  
   132  func (v NullableFloatValueItem) Get() *FloatValueItem {
   133  	return v.value
   134  }
   135  
   136  func (v *NullableFloatValueItem) Set(val *FloatValueItem) {
   137  	v.value = val
   138  	v.isSet = true
   139  }
   140  
   141  func (v NullableFloatValueItem) IsSet() bool {
   142  	return v.isSet
   143  }
   144  
   145  func (v *NullableFloatValueItem) Unset() {
   146  	v.value = nil
   147  	v.isSet = false
   148  }
   149  
   150  func NewNullableFloatValueItem(val *FloatValueItem) *NullableFloatValueItem {
   151  	return &NullableFloatValueItem{value: val, isSet: true}
   152  }
   153  
   154  func (v NullableFloatValueItem) MarshalJSON() ([]byte, error) {
   155  	return json.Marshal(v.value)
   156  }
   157  
   158  func (v *NullableFloatValueItem) UnmarshalJSON(src []byte) error {
   159  	v.isSet = true
   160  	return json.Unmarshal(src, &v.value)
   161  }