Files
sdk/model_translation.go

302 lines
7.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 Translation type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Translation{}
// Translation struct for Translation
type Translation struct {
Cached *bool `json:"cached,omitempty"`
Error *string `json:"error,omitempty"`
Source *string `json:"source,omitempty"`
State *string `json:"state,omitempty"`
Text *string `json:"text,omitempty"`
AdditionalProperties map[string]interface{}
}
type _Translation Translation
// NewTranslation instantiates a new Translation 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 NewTranslation() *Translation {
this := Translation{}
return &this
}
// NewTranslationWithDefaults instantiates a new Translation 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 NewTranslationWithDefaults() *Translation {
this := Translation{}
return &this
}
// GetCached returns the Cached field value if set, zero value otherwise.
func (o *Translation) GetCached() bool {
if o == nil || IsNil(o.Cached) {
var ret bool
return ret
}
return *o.Cached
}
// GetCachedOk returns a tuple with the Cached field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Translation) GetCachedOk() (*bool, bool) {
if o == nil || IsNil(o.Cached) {
return nil, false
}
return o.Cached, true
}
// HasCached returns a boolean if a field has been set.
func (o *Translation) HasCached() bool {
if o != nil && !IsNil(o.Cached) {
return true
}
return false
}
// SetCached gets a reference to the given bool and assigns it to the Cached field.
func (o *Translation) SetCached(v bool) {
o.Cached = &v
}
// GetError returns the Error field value if set, zero value otherwise.
func (o *Translation) GetError() string {
if o == nil || IsNil(o.Error) {
var ret string
return ret
}
return *o.Error
}
// GetErrorOk returns a tuple with the Error field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Translation) GetErrorOk() (*string, bool) {
if o == nil || IsNil(o.Error) {
return nil, false
}
return o.Error, true
}
// HasError returns a boolean if a field has been set.
func (o *Translation) HasError() bool {
if o != nil && !IsNil(o.Error) {
return true
}
return false
}
// SetError gets a reference to the given string and assigns it to the Error field.
func (o *Translation) SetError(v string) {
o.Error = &v
}
// GetSource returns the Source field value if set, zero value otherwise.
func (o *Translation) GetSource() string {
if o == nil || IsNil(o.Source) {
var ret string
return ret
}
return *o.Source
}
// GetSourceOk returns a tuple with the Source field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Translation) GetSourceOk() (*string, bool) {
if o == nil || IsNil(o.Source) {
return nil, false
}
return o.Source, true
}
// HasSource returns a boolean if a field has been set.
func (o *Translation) HasSource() bool {
if o != nil && !IsNil(o.Source) {
return true
}
return false
}
// SetSource gets a reference to the given string and assigns it to the Source field.
func (o *Translation) SetSource(v string) {
o.Source = &v
}
// GetState returns the State field value if set, zero value otherwise.
func (o *Translation) GetState() string {
if o == nil || IsNil(o.State) {
var ret string
return ret
}
return *o.State
}
// GetStateOk returns a tuple with the State field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Translation) GetStateOk() (*string, bool) {
if o == nil || IsNil(o.State) {
return nil, false
}
return o.State, true
}
// HasState returns a boolean if a field has been set.
func (o *Translation) HasState() bool {
if o != nil && !IsNil(o.State) {
return true
}
return false
}
// SetState gets a reference to the given string and assigns it to the State field.
func (o *Translation) SetState(v string) {
o.State = &v
}
// GetText returns the Text field value if set, zero value otherwise.
func (o *Translation) GetText() string {
if o == nil || IsNil(o.Text) {
var ret string
return ret
}
return *o.Text
}
// GetTextOk returns a tuple with the Text field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Translation) GetTextOk() (*string, bool) {
if o == nil || IsNil(o.Text) {
return nil, false
}
return o.Text, true
}
// HasText returns a boolean if a field has been set.
func (o *Translation) HasText() bool {
if o != nil && !IsNil(o.Text) {
return true
}
return false
}
// SetText gets a reference to the given string and assigns it to the Text field.
func (o *Translation) SetText(v string) {
o.Text = &v
}
func (o Translation) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o Translation) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Cached) {
toSerialize["cached"] = o.Cached
}
if !IsNil(o.Error) {
toSerialize["error"] = o.Error
}
if !IsNil(o.Source) {
toSerialize["source"] = o.Source
}
if !IsNil(o.State) {
toSerialize["state"] = o.State
}
if !IsNil(o.Text) {
toSerialize["text"] = o.Text
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *Translation) UnmarshalJSON(data []byte) (err error) {
varTranslation := _Translation{}
err = json.Unmarshal(data, &varTranslation)
if err != nil {
return err
}
*o = Translation(varTranslation)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "cached")
delete(additionalProperties, "error")
delete(additionalProperties, "source")
delete(additionalProperties, "state")
delete(additionalProperties, "text")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableTranslation struct {
value *Translation
isSet bool
}
func (v NullableTranslation) Get() *Translation {
return v.value
}
func (v *NullableTranslation) Set(val *Translation) {
v.value = val
v.isSet = true
}
func (v NullableTranslation) IsSet() bool {
return v.isSet
}
func (v *NullableTranslation) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTranslation(val *Translation) *NullableTranslation {
return &NullableTranslation{value: val, isSet: true}
}
func (v NullableTranslation) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTranslation) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}