Files
sdk/model_domain_transfer_req.go

236 lines
6.0 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 DomainTransferReq type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &DomainTransferReq{}
// DomainTransferReq struct for DomainTransferReq
type DomainTransferReq struct {
// AuthCode is the transfer authorization the losing registrar issued. It is required.
AuthCode string `json:"authCode"`
// Domain is the name to move in. It is required.
Domain string `json:"domain"`
// Years is the term to buy on transfer, defaulting to 1.
Years *int64 `json:"years,omitempty"`
AdditionalProperties map[string]interface{}
}
type _DomainTransferReq DomainTransferReq
// NewDomainTransferReq instantiates a new DomainTransferReq 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 NewDomainTransferReq(authCode string, domain string) *DomainTransferReq {
this := DomainTransferReq{}
this.AuthCode = authCode
this.Domain = domain
return &this
}
// NewDomainTransferReqWithDefaults instantiates a new DomainTransferReq 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 NewDomainTransferReqWithDefaults() *DomainTransferReq {
this := DomainTransferReq{}
return &this
}
// GetAuthCode returns the AuthCode field value
func (o *DomainTransferReq) GetAuthCode() string {
if o == nil {
var ret string
return ret
}
return o.AuthCode
}
// GetAuthCodeOk returns a tuple with the AuthCode field value
// and a boolean to check if the value has been set.
func (o *DomainTransferReq) GetAuthCodeOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.AuthCode, true
}
// SetAuthCode sets field value
func (o *DomainTransferReq) SetAuthCode(v string) {
o.AuthCode = v
}
// GetDomain returns the Domain field value
func (o *DomainTransferReq) 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 *DomainTransferReq) GetDomainOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Domain, true
}
// SetDomain sets field value
func (o *DomainTransferReq) SetDomain(v string) {
o.Domain = v
}
// GetYears returns the Years field value if set, zero value otherwise.
func (o *DomainTransferReq) 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 *DomainTransferReq) 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 *DomainTransferReq) 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 *DomainTransferReq) SetYears(v int64) {
o.Years = &v
}
func (o DomainTransferReq) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o DomainTransferReq) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["authCode"] = o.AuthCode
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 *DomainTransferReq) 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{
"authCode",
"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)
}
}
varDomainTransferReq := _DomainTransferReq{}
err = json.Unmarshal(data, &varDomainTransferReq)
if err != nil {
return err
}
*o = DomainTransferReq(varDomainTransferReq)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "authCode")
delete(additionalProperties, "domain")
delete(additionalProperties, "years")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableDomainTransferReq struct {
value *DomainTransferReq
isSet bool
}
func (v NullableDomainTransferReq) Get() *DomainTransferReq {
return v.value
}
func (v *NullableDomainTransferReq) Set(val *DomainTransferReq) {
v.value = val
v.isSet = true
}
func (v NullableDomainTransferReq) IsSet() bool {
return v.isSet
}
func (v *NullableDomainTransferReq) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableDomainTransferReq(val *DomainTransferReq) *NullableDomainTransferReq {
return &NullableDomainTransferReq{value: val, isSet: true}
}
func (v NullableDomainTransferReq) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableDomainTransferReq) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}