Files
sdk/model_voucher.go

302 lines
7.4 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 Voucher type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Voucher{}
// Voucher struct for Voucher
type Voucher struct {
Description *string `json:"description,omitempty"`
Legs []Leg `json:"legs,omitempty"`
PostingAt *string `json:"postingAt,omitempty"`
SourceId *string `json:"sourceId,omitempty"`
SourceKind *string `json:"sourceKind,omitempty"`
AdditionalProperties map[string]interface{}
}
type _Voucher Voucher
// NewVoucher instantiates a new Voucher 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 NewVoucher() *Voucher {
this := Voucher{}
return &this
}
// NewVoucherWithDefaults instantiates a new Voucher 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 NewVoucherWithDefaults() *Voucher {
this := Voucher{}
return &this
}
// GetDescription returns the Description field value if set, zero value otherwise.
func (o *Voucher) 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 *Voucher) 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 *Voucher) 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 *Voucher) SetDescription(v string) {
o.Description = &v
}
// GetLegs returns the Legs field value if set, zero value otherwise.
func (o *Voucher) GetLegs() []Leg {
if o == nil || IsNil(o.Legs) {
var ret []Leg
return ret
}
return o.Legs
}
// GetLegsOk returns a tuple with the Legs field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Voucher) GetLegsOk() ([]Leg, bool) {
if o == nil || IsNil(o.Legs) {
return nil, false
}
return o.Legs, true
}
// HasLegs returns a boolean if a field has been set.
func (o *Voucher) HasLegs() bool {
if o != nil && !IsNil(o.Legs) {
return true
}
return false
}
// SetLegs gets a reference to the given []Leg and assigns it to the Legs field.
func (o *Voucher) SetLegs(v []Leg) {
o.Legs = v
}
// GetPostingAt returns the PostingAt field value if set, zero value otherwise.
func (o *Voucher) GetPostingAt() string {
if o == nil || IsNil(o.PostingAt) {
var ret string
return ret
}
return *o.PostingAt
}
// GetPostingAtOk returns a tuple with the PostingAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Voucher) GetPostingAtOk() (*string, bool) {
if o == nil || IsNil(o.PostingAt) {
return nil, false
}
return o.PostingAt, true
}
// HasPostingAt returns a boolean if a field has been set.
func (o *Voucher) HasPostingAt() bool {
if o != nil && !IsNil(o.PostingAt) {
return true
}
return false
}
// SetPostingAt gets a reference to the given string and assigns it to the PostingAt field.
func (o *Voucher) SetPostingAt(v string) {
o.PostingAt = &v
}
// GetSourceId returns the SourceId field value if set, zero value otherwise.
func (o *Voucher) GetSourceId() string {
if o == nil || IsNil(o.SourceId) {
var ret string
return ret
}
return *o.SourceId
}
// GetSourceIdOk returns a tuple with the SourceId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Voucher) GetSourceIdOk() (*string, bool) {
if o == nil || IsNil(o.SourceId) {
return nil, false
}
return o.SourceId, true
}
// HasSourceId returns a boolean if a field has been set.
func (o *Voucher) HasSourceId() bool {
if o != nil && !IsNil(o.SourceId) {
return true
}
return false
}
// SetSourceId gets a reference to the given string and assigns it to the SourceId field.
func (o *Voucher) SetSourceId(v string) {
o.SourceId = &v
}
// GetSourceKind returns the SourceKind field value if set, zero value otherwise.
func (o *Voucher) GetSourceKind() string {
if o == nil || IsNil(o.SourceKind) {
var ret string
return ret
}
return *o.SourceKind
}
// GetSourceKindOk returns a tuple with the SourceKind field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Voucher) GetSourceKindOk() (*string, bool) {
if o == nil || IsNil(o.SourceKind) {
return nil, false
}
return o.SourceKind, true
}
// HasSourceKind returns a boolean if a field has been set.
func (o *Voucher) HasSourceKind() bool {
if o != nil && !IsNil(o.SourceKind) {
return true
}
return false
}
// SetSourceKind gets a reference to the given string and assigns it to the SourceKind field.
func (o *Voucher) SetSourceKind(v string) {
o.SourceKind = &v
}
func (o Voucher) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o Voucher) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Description) {
toSerialize["description"] = o.Description
}
if !IsNil(o.Legs) {
toSerialize["legs"] = o.Legs
}
if !IsNil(o.PostingAt) {
toSerialize["postingAt"] = o.PostingAt
}
if !IsNil(o.SourceId) {
toSerialize["sourceId"] = o.SourceId
}
if !IsNil(o.SourceKind) {
toSerialize["sourceKind"] = o.SourceKind
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *Voucher) UnmarshalJSON(data []byte) (err error) {
varVoucher := _Voucher{}
err = json.Unmarshal(data, &varVoucher)
if err != nil {
return err
}
*o = Voucher(varVoucher)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "description")
delete(additionalProperties, "legs")
delete(additionalProperties, "postingAt")
delete(additionalProperties, "sourceId")
delete(additionalProperties, "sourceKind")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableVoucher struct {
value *Voucher
isSet bool
}
func (v NullableVoucher) Get() *Voucher {
return v.value
}
func (v *NullableVoucher) Set(val *Voucher) {
v.value = val
v.isSet = true
}
func (v NullableVoucher) IsSet() bool {
return v.isSet
}
func (v *NullableVoucher) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableVoucher(val *Voucher) *NullableVoucher {
return &NullableVoucher{value: val, isSet: true}
}
func (v NullableVoucher) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableVoucher) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}