Files
sdk/model_link.go

154 lines
3.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 Link type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Link{}
// Link struct for Link
type Link struct {
Href *string `json:"href,omitempty"`
AdditionalProperties map[string]interface{}
}
type _Link Link
// NewLink instantiates a new Link 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 NewLink() *Link {
this := Link{}
return &this
}
// NewLinkWithDefaults instantiates a new Link 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 NewLinkWithDefaults() *Link {
this := Link{}
return &this
}
// GetHref returns the Href field value if set, zero value otherwise.
func (o *Link) GetHref() string {
if o == nil || IsNil(o.Href) {
var ret string
return ret
}
return *o.Href
}
// GetHrefOk returns a tuple with the Href field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Link) GetHrefOk() (*string, bool) {
if o == nil || IsNil(o.Href) {
return nil, false
}
return o.Href, true
}
// HasHref returns a boolean if a field has been set.
func (o *Link) HasHref() bool {
if o != nil && !IsNil(o.Href) {
return true
}
return false
}
// SetHref gets a reference to the given string and assigns it to the Href field.
func (o *Link) SetHref(v string) {
o.Href = &v
}
func (o Link) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o Link) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Href) {
toSerialize["href"] = o.Href
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *Link) UnmarshalJSON(data []byte) (err error) {
varLink := _Link{}
err = json.Unmarshal(data, &varLink)
if err != nil {
return err
}
*o = Link(varLink)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "href")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableLink struct {
value *Link
isSet bool
}
func (v NullableLink) Get() *Link {
return v.value
}
func (v *NullableLink) Set(val *Link) {
v.value = val
v.isSet = true
}
func (v NullableLink) IsSet() bool {
return v.isSet
}
func (v *NullableLink) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableLink(val *Link) *NullableLink {
return &NullableLink{value: val, isSet: true}
}
func (v NullableLink) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableLink) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}