Files
sdk/model_grants.go

228 lines
5.3 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 Grants type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Grants{}
// Grants struct for Grants
type Grants struct {
Ads *bool `json:"ads,omitempty"`
Analytics *bool `json:"analytics,omitempty"`
Marketing *bool `json:"marketing,omitempty"`
AdditionalProperties map[string]interface{}
}
type _Grants Grants
// NewGrants instantiates a new Grants 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 NewGrants() *Grants {
this := Grants{}
return &this
}
// NewGrantsWithDefaults instantiates a new Grants 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 NewGrantsWithDefaults() *Grants {
this := Grants{}
return &this
}
// GetAds returns the Ads field value if set, zero value otherwise.
func (o *Grants) GetAds() bool {
if o == nil || IsNil(o.Ads) {
var ret bool
return ret
}
return *o.Ads
}
// GetAdsOk returns a tuple with the Ads field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Grants) GetAdsOk() (*bool, bool) {
if o == nil || IsNil(o.Ads) {
return nil, false
}
return o.Ads, true
}
// HasAds returns a boolean if a field has been set.
func (o *Grants) HasAds() bool {
if o != nil && !IsNil(o.Ads) {
return true
}
return false
}
// SetAds gets a reference to the given bool and assigns it to the Ads field.
func (o *Grants) SetAds(v bool) {
o.Ads = &v
}
// GetAnalytics returns the Analytics field value if set, zero value otherwise.
func (o *Grants) GetAnalytics() bool {
if o == nil || IsNil(o.Analytics) {
var ret bool
return ret
}
return *o.Analytics
}
// GetAnalyticsOk returns a tuple with the Analytics field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Grants) GetAnalyticsOk() (*bool, bool) {
if o == nil || IsNil(o.Analytics) {
return nil, false
}
return o.Analytics, true
}
// HasAnalytics returns a boolean if a field has been set.
func (o *Grants) HasAnalytics() bool {
if o != nil && !IsNil(o.Analytics) {
return true
}
return false
}
// SetAnalytics gets a reference to the given bool and assigns it to the Analytics field.
func (o *Grants) SetAnalytics(v bool) {
o.Analytics = &v
}
// GetMarketing returns the Marketing field value if set, zero value otherwise.
func (o *Grants) GetMarketing() bool {
if o == nil || IsNil(o.Marketing) {
var ret bool
return ret
}
return *o.Marketing
}
// GetMarketingOk returns a tuple with the Marketing field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Grants) GetMarketingOk() (*bool, bool) {
if o == nil || IsNil(o.Marketing) {
return nil, false
}
return o.Marketing, true
}
// HasMarketing returns a boolean if a field has been set.
func (o *Grants) HasMarketing() bool {
if o != nil && !IsNil(o.Marketing) {
return true
}
return false
}
// SetMarketing gets a reference to the given bool and assigns it to the Marketing field.
func (o *Grants) SetMarketing(v bool) {
o.Marketing = &v
}
func (o Grants) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o Grants) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Ads) {
toSerialize["ads"] = o.Ads
}
if !IsNil(o.Analytics) {
toSerialize["analytics"] = o.Analytics
}
if !IsNil(o.Marketing) {
toSerialize["marketing"] = o.Marketing
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *Grants) UnmarshalJSON(data []byte) (err error) {
varGrants := _Grants{}
err = json.Unmarshal(data, &varGrants)
if err != nil {
return err
}
*o = Grants(varGrants)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "ads")
delete(additionalProperties, "analytics")
delete(additionalProperties, "marketing")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableGrants struct {
value *Grants
isSet bool
}
func (v NullableGrants) Get() *Grants {
return v.value
}
func (v *NullableGrants) Set(val *Grants) {
v.value = val
v.isSet = true
}
func (v NullableGrants) IsSet() bool {
return v.isSet
}
func (v *NullableGrants) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableGrants(val *Grants) *NullableGrants {
return &NullableGrants{value: val, isSet: true}
}
func (v NullableGrants) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableGrants) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}