Files
sdk/model_domain_order.go

244 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"
"fmt"
)
// checks if the DomainOrder type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &DomainOrder{}
// DomainOrder struct for DomainOrder
type DomainOrder struct {
// Contacts is the WHOIS contact set. Omit it and the registrar uses the reseller account's default contacts.
Contacts *DomainContacts `json:"contacts,omitempty"`
// Domain is the name to buy. It is required.
Domain string `json:"domain"`
// Years is the term to buy, defaulting to 1.
Years *int64 `json:"years,omitempty"`
AdditionalProperties map[string]interface{}
}
type _DomainOrder DomainOrder
// NewDomainOrder instantiates a new DomainOrder 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 NewDomainOrder(domain string) *DomainOrder {
this := DomainOrder{}
this.Domain = domain
return &this
}
// NewDomainOrderWithDefaults instantiates a new DomainOrder 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 NewDomainOrderWithDefaults() *DomainOrder {
this := DomainOrder{}
return &this
}
// GetContacts returns the Contacts field value if set, zero value otherwise.
func (o *DomainOrder) GetContacts() DomainContacts {
if o == nil || IsNil(o.Contacts) {
var ret DomainContacts
return ret
}
return *o.Contacts
}
// GetContactsOk returns a tuple with the Contacts field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DomainOrder) GetContactsOk() (*DomainContacts, bool) {
if o == nil || IsNil(o.Contacts) {
return nil, false
}
return o.Contacts, true
}
// HasContacts returns a boolean if a field has been set.
func (o *DomainOrder) HasContacts() bool {
if o != nil && !IsNil(o.Contacts) {
return true
}
return false
}
// SetContacts gets a reference to the given DomainContacts and assigns it to the Contacts field.
func (o *DomainOrder) SetContacts(v DomainContacts) {
o.Contacts = &v
}
// GetDomain returns the Domain field value
func (o *DomainOrder) GetDomain() string {
if o == nil {
var ret string
return ret
}
return o.Domain
}
// GetDomainOk returns a tuple with the Domain field value
// and a boolean to check if the value has been set.
func (o *DomainOrder) GetDomainOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Domain, true
}
// SetDomain sets field value
func (o *DomainOrder) SetDomain(v string) {
o.Domain = v
}
// GetYears returns the Years field value if set, zero value otherwise.
func (o *DomainOrder) GetYears() int64 {
if o == nil || IsNil(o.Years) {
var ret int64
return ret
}
return *o.Years
}
// GetYearsOk returns a tuple with the Years field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DomainOrder) GetYearsOk() (*int64, bool) {
if o == nil || IsNil(o.Years) {
return nil, false
}
return o.Years, true
}
// HasYears returns a boolean if a field has been set.
func (o *DomainOrder) HasYears() bool {
if o != nil && !IsNil(o.Years) {
return true
}
return false
}
// SetYears gets a reference to the given int64 and assigns it to the Years field.
func (o *DomainOrder) SetYears(v int64) {
o.Years = &v
}
func (o DomainOrder) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o DomainOrder) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Contacts) {
toSerialize["contacts"] = o.Contacts
}
toSerialize["domain"] = o.Domain
if !IsNil(o.Years) {
toSerialize["years"] = o.Years
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *DomainOrder) UnmarshalJSON(data []byte) (err error) {
// This validates that all required properties are included in the JSON object
// by unmarshalling the object into a generic map with string keys and checking
// that every required field exists as a key in the generic map.
requiredProperties := []string{
"domain",
}
allProperties := make(map[string]interface{})
err = json.Unmarshal(data, &allProperties)
if err != nil {
return err
}
for _, requiredProperty := range requiredProperties {
if _, exists := allProperties[requiredProperty]; !exists {
return fmt.Errorf("no value given for required property %v", requiredProperty)
}
}
varDomainOrder := _DomainOrder{}
err = json.Unmarshal(data, &varDomainOrder)
if err != nil {
return err
}
*o = DomainOrder(varDomainOrder)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "contacts")
delete(additionalProperties, "domain")
delete(additionalProperties, "years")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableDomainOrder struct {
value *DomainOrder
isSet bool
}
func (v NullableDomainOrder) Get() *DomainOrder {
return v.value
}
func (v *NullableDomainOrder) Set(val *DomainOrder) {
v.value = val
v.isSet = true
}
func (v NullableDomainOrder) IsSet() bool {
return v.isSet
}
func (v *NullableDomainOrder) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableDomainOrder(val *DomainOrder) *NullableDomainOrder {
return &NullableDomainOrder{value: val, isSet: true}
}
func (v NullableDomainOrder) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableDomainOrder) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}