Files
sdk/model_leg.go

228 lines
5.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 Leg type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Leg{}
// Leg struct for Leg
type Leg struct {
Account *string `json:"account,omitempty"`
Credit *int32 `json:"credit,omitempty"`
Debit *int32 `json:"debit,omitempty"`
AdditionalProperties map[string]interface{}
}
type _Leg Leg
// NewLeg instantiates a new Leg 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 NewLeg() *Leg {
this := Leg{}
return &this
}
// NewLegWithDefaults instantiates a new Leg 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 NewLegWithDefaults() *Leg {
this := Leg{}
return &this
}
// GetAccount returns the Account field value if set, zero value otherwise.
func (o *Leg) GetAccount() string {
if o == nil || IsNil(o.Account) {
var ret string
return ret
}
return *o.Account
}
// GetAccountOk returns a tuple with the Account field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Leg) GetAccountOk() (*string, bool) {
if o == nil || IsNil(o.Account) {
return nil, false
}
return o.Account, true
}
// HasAccount returns a boolean if a field has been set.
func (o *Leg) HasAccount() bool {
if o != nil && !IsNil(o.Account) {
return true
}
return false
}
// SetAccount gets a reference to the given string and assigns it to the Account field.
func (o *Leg) SetAccount(v string) {
o.Account = &v
}
// GetCredit returns the Credit field value if set, zero value otherwise.
func (o *Leg) GetCredit() int32 {
if o == nil || IsNil(o.Credit) {
var ret int32
return ret
}
return *o.Credit
}
// GetCreditOk returns a tuple with the Credit field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Leg) GetCreditOk() (*int32, bool) {
if o == nil || IsNil(o.Credit) {
return nil, false
}
return o.Credit, true
}
// HasCredit returns a boolean if a field has been set.
func (o *Leg) HasCredit() bool {
if o != nil && !IsNil(o.Credit) {
return true
}
return false
}
// SetCredit gets a reference to the given int32 and assigns it to the Credit field.
func (o *Leg) SetCredit(v int32) {
o.Credit = &v
}
// GetDebit returns the Debit field value if set, zero value otherwise.
func (o *Leg) GetDebit() int32 {
if o == nil || IsNil(o.Debit) {
var ret int32
return ret
}
return *o.Debit
}
// GetDebitOk returns a tuple with the Debit field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Leg) GetDebitOk() (*int32, bool) {
if o == nil || IsNil(o.Debit) {
return nil, false
}
return o.Debit, true
}
// HasDebit returns a boolean if a field has been set.
func (o *Leg) HasDebit() bool {
if o != nil && !IsNil(o.Debit) {
return true
}
return false
}
// SetDebit gets a reference to the given int32 and assigns it to the Debit field.
func (o *Leg) SetDebit(v int32) {
o.Debit = &v
}
func (o Leg) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o Leg) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Account) {
toSerialize["account"] = o.Account
}
if !IsNil(o.Credit) {
toSerialize["credit"] = o.Credit
}
if !IsNil(o.Debit) {
toSerialize["debit"] = o.Debit
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *Leg) UnmarshalJSON(data []byte) (err error) {
varLeg := _Leg{}
err = json.Unmarshal(data, &varLeg)
if err != nil {
return err
}
*o = Leg(varLeg)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "account")
delete(additionalProperties, "credit")
delete(additionalProperties, "debit")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableLeg struct {
value *Leg
isSet bool
}
func (v NullableLeg) Get() *Leg {
return v.value
}
func (v *NullableLeg) Set(val *Leg) {
v.value = val
v.isSet = true
}
func (v NullableLeg) IsSet() bool {
return v.isSet
}
func (v *NullableLeg) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableLeg(val *Leg) *NullableLeg {
return &NullableLeg{value: val, isSet: true}
}
func (v NullableLeg) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableLeg) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}