Files
sdk/model_licensing_verify_request.go

206 lines
5.5 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 LicensingVerifyRequest type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &LicensingVerifyRequest{}
// LicensingVerifyRequest struct for LicensingVerifyRequest
type LicensingVerifyRequest struct {
// App overrides the app_id the token is expected to carry. Leave it empty and the token's own app_id is used — an online verify is informational, and it is the ENGINE that enforces the app at boot.
App *string `json:"app,omitempty"`
// Token is the license token to check.
Token string `json:"token"`
AdditionalProperties map[string]interface{}
}
type _LicensingVerifyRequest LicensingVerifyRequest
// NewLicensingVerifyRequest instantiates a new LicensingVerifyRequest 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 NewLicensingVerifyRequest(token string) *LicensingVerifyRequest {
this := LicensingVerifyRequest{}
this.Token = token
return &this
}
// NewLicensingVerifyRequestWithDefaults instantiates a new LicensingVerifyRequest 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 NewLicensingVerifyRequestWithDefaults() *LicensingVerifyRequest {
this := LicensingVerifyRequest{}
return &this
}
// GetApp returns the App field value if set, zero value otherwise.
func (o *LicensingVerifyRequest) GetApp() string {
if o == nil || IsNil(o.App) {
var ret string
return ret
}
return *o.App
}
// GetAppOk returns a tuple with the App field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LicensingVerifyRequest) GetAppOk() (*string, bool) {
if o == nil || IsNil(o.App) {
return nil, false
}
return o.App, true
}
// HasApp returns a boolean if a field has been set.
func (o *LicensingVerifyRequest) HasApp() bool {
if o != nil && !IsNil(o.App) {
return true
}
return false
}
// SetApp gets a reference to the given string and assigns it to the App field.
func (o *LicensingVerifyRequest) SetApp(v string) {
o.App = &v
}
// GetToken returns the Token field value
func (o *LicensingVerifyRequest) GetToken() string {
if o == nil {
var ret string
return ret
}
return o.Token
}
// GetTokenOk returns a tuple with the Token field value
// and a boolean to check if the value has been set.
func (o *LicensingVerifyRequest) GetTokenOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Token, true
}
// SetToken sets field value
func (o *LicensingVerifyRequest) SetToken(v string) {
o.Token = v
}
func (o LicensingVerifyRequest) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o LicensingVerifyRequest) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.App) {
toSerialize["app"] = o.App
}
toSerialize["token"] = o.Token
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *LicensingVerifyRequest) 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{
"token",
}
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)
}
}
varLicensingVerifyRequest := _LicensingVerifyRequest{}
err = json.Unmarshal(data, &varLicensingVerifyRequest)
if err != nil {
return err
}
*o = LicensingVerifyRequest(varLicensingVerifyRequest)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "app")
delete(additionalProperties, "token")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableLicensingVerifyRequest struct {
value *LicensingVerifyRequest
isSet bool
}
func (v NullableLicensingVerifyRequest) Get() *LicensingVerifyRequest {
return v.value
}
func (v *NullableLicensingVerifyRequest) Set(val *LicensingVerifyRequest) {
v.value = val
v.isSet = true
}
func (v NullableLicensingVerifyRequest) IsSet() bool {
return v.isSet
}
func (v *NullableLicensingVerifyRequest) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableLicensingVerifyRequest(val *LicensingVerifyRequest) *NullableLicensingVerifyRequest {
return &NullableLicensingVerifyRequest{value: val, isSet: true}
}
func (v NullableLicensingVerifyRequest) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableLicensingVerifyRequest) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}