Files
sdk/model_train_term.go

231 lines
5.5 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 TrainTerm type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &TrainTerm{}
// TrainTerm struct for TrainTerm
type TrainTerm struct {
// Kind names the term.
Kind *string `json:"kind,omitempty"`
// Margin is a hinge's margin, in logits.
Margin *float64 `json:"margin,omitempty"`
// Weight scales it; 0 is off.
Weight *float64 `json:"weight,omitempty"`
AdditionalProperties map[string]interface{}
}
type _TrainTerm TrainTerm
// NewTrainTerm instantiates a new TrainTerm 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 NewTrainTerm() *TrainTerm {
this := TrainTerm{}
return &this
}
// NewTrainTermWithDefaults instantiates a new TrainTerm 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 NewTrainTermWithDefaults() *TrainTerm {
this := TrainTerm{}
return &this
}
// GetKind returns the Kind field value if set, zero value otherwise.
func (o *TrainTerm) GetKind() string {
if o == nil || IsNil(o.Kind) {
var ret string
return ret
}
return *o.Kind
}
// GetKindOk returns a tuple with the Kind field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainTerm) GetKindOk() (*string, bool) {
if o == nil || IsNil(o.Kind) {
return nil, false
}
return o.Kind, true
}
// HasKind returns a boolean if a field has been set.
func (o *TrainTerm) HasKind() bool {
if o != nil && !IsNil(o.Kind) {
return true
}
return false
}
// SetKind gets a reference to the given string and assigns it to the Kind field.
func (o *TrainTerm) SetKind(v string) {
o.Kind = &v
}
// GetMargin returns the Margin field value if set, zero value otherwise.
func (o *TrainTerm) GetMargin() float64 {
if o == nil || IsNil(o.Margin) {
var ret float64
return ret
}
return *o.Margin
}
// GetMarginOk returns a tuple with the Margin field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainTerm) GetMarginOk() (*float64, bool) {
if o == nil || IsNil(o.Margin) {
return nil, false
}
return o.Margin, true
}
// HasMargin returns a boolean if a field has been set.
func (o *TrainTerm) HasMargin() bool {
if o != nil && !IsNil(o.Margin) {
return true
}
return false
}
// SetMargin gets a reference to the given float64 and assigns it to the Margin field.
func (o *TrainTerm) SetMargin(v float64) {
o.Margin = &v
}
// GetWeight returns the Weight field value if set, zero value otherwise.
func (o *TrainTerm) GetWeight() float64 {
if o == nil || IsNil(o.Weight) {
var ret float64
return ret
}
return *o.Weight
}
// GetWeightOk returns a tuple with the Weight field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainTerm) GetWeightOk() (*float64, bool) {
if o == nil || IsNil(o.Weight) {
return nil, false
}
return o.Weight, true
}
// HasWeight returns a boolean if a field has been set.
func (o *TrainTerm) HasWeight() bool {
if o != nil && !IsNil(o.Weight) {
return true
}
return false
}
// SetWeight gets a reference to the given float64 and assigns it to the Weight field.
func (o *TrainTerm) SetWeight(v float64) {
o.Weight = &v
}
func (o TrainTerm) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o TrainTerm) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Kind) {
toSerialize["kind"] = o.Kind
}
if !IsNil(o.Margin) {
toSerialize["margin"] = o.Margin
}
if !IsNil(o.Weight) {
toSerialize["weight"] = o.Weight
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *TrainTerm) UnmarshalJSON(data []byte) (err error) {
varTrainTerm := _TrainTerm{}
err = json.Unmarshal(data, &varTrainTerm)
if err != nil {
return err
}
*o = TrainTerm(varTrainTerm)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "kind")
delete(additionalProperties, "margin")
delete(additionalProperties, "weight")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableTrainTerm struct {
value *TrainTerm
isSet bool
}
func (v NullableTrainTerm) Get() *TrainTerm {
return v.value
}
func (v *NullableTrainTerm) Set(val *TrainTerm) {
v.value = val
v.isSet = true
}
func (v NullableTrainTerm) IsSet() bool {
return v.isSet
}
func (v *NullableTrainTerm) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTrainTerm(val *TrainTerm) *NullableTrainTerm {
return &NullableTrainTerm{value: val, isSet: true}
}
func (v NullableTrainTerm) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTrainTerm) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}