Files
sdk/model_graph_graph_entity_in.go

244 lines
6.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"
"fmt"
)
// checks if the GraphGraphEntityIn type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &GraphGraphEntityIn{}
// GraphGraphEntityIn struct for GraphGraphEntityIn
type GraphGraphEntityIn struct {
// AsKnown is how much this plane had heard, RFC 3339: the answer as it would have been given then. Absent is now.
AsKnown *string `json:"as_known,omitempty"`
// AsOf is the instant of the world to answer about, RFC 3339: what held then. Absent is now.
AsOf *string `json:"as_of,omitempty"`
// Entity is the entity key to resolve. Required.
Entity string `json:"entity"`
AdditionalProperties map[string]interface{}
}
type _GraphGraphEntityIn GraphGraphEntityIn
// NewGraphGraphEntityIn instantiates a new GraphGraphEntityIn 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 NewGraphGraphEntityIn(entity string) *GraphGraphEntityIn {
this := GraphGraphEntityIn{}
this.Entity = entity
return &this
}
// NewGraphGraphEntityInWithDefaults instantiates a new GraphGraphEntityIn 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 NewGraphGraphEntityInWithDefaults() *GraphGraphEntityIn {
this := GraphGraphEntityIn{}
return &this
}
// GetAsKnown returns the AsKnown field value if set, zero value otherwise.
func (o *GraphGraphEntityIn) GetAsKnown() string {
if o == nil || IsNil(o.AsKnown) {
var ret string
return ret
}
return *o.AsKnown
}
// GetAsKnownOk returns a tuple with the AsKnown field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GraphGraphEntityIn) GetAsKnownOk() (*string, bool) {
if o == nil || IsNil(o.AsKnown) {
return nil, false
}
return o.AsKnown, true
}
// HasAsKnown returns a boolean if a field has been set.
func (o *GraphGraphEntityIn) HasAsKnown() bool {
if o != nil && !IsNil(o.AsKnown) {
return true
}
return false
}
// SetAsKnown gets a reference to the given string and assigns it to the AsKnown field.
func (o *GraphGraphEntityIn) SetAsKnown(v string) {
o.AsKnown = &v
}
// GetAsOf returns the AsOf field value if set, zero value otherwise.
func (o *GraphGraphEntityIn) GetAsOf() string {
if o == nil || IsNil(o.AsOf) {
var ret string
return ret
}
return *o.AsOf
}
// GetAsOfOk returns a tuple with the AsOf field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GraphGraphEntityIn) GetAsOfOk() (*string, bool) {
if o == nil || IsNil(o.AsOf) {
return nil, false
}
return o.AsOf, true
}
// HasAsOf returns a boolean if a field has been set.
func (o *GraphGraphEntityIn) HasAsOf() bool {
if o != nil && !IsNil(o.AsOf) {
return true
}
return false
}
// SetAsOf gets a reference to the given string and assigns it to the AsOf field.
func (o *GraphGraphEntityIn) SetAsOf(v string) {
o.AsOf = &v
}
// GetEntity returns the Entity field value
func (o *GraphGraphEntityIn) GetEntity() string {
if o == nil {
var ret string
return ret
}
return o.Entity
}
// GetEntityOk returns a tuple with the Entity field value
// and a boolean to check if the value has been set.
func (o *GraphGraphEntityIn) GetEntityOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Entity, true
}
// SetEntity sets field value
func (o *GraphGraphEntityIn) SetEntity(v string) {
o.Entity = v
}
func (o GraphGraphEntityIn) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o GraphGraphEntityIn) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.AsKnown) {
toSerialize["as_known"] = o.AsKnown
}
if !IsNil(o.AsOf) {
toSerialize["as_of"] = o.AsOf
}
toSerialize["entity"] = o.Entity
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *GraphGraphEntityIn) 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{
"entity",
}
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)
}
}
varGraphGraphEntityIn := _GraphGraphEntityIn{}
err = json.Unmarshal(data, &varGraphGraphEntityIn)
if err != nil {
return err
}
*o = GraphGraphEntityIn(varGraphGraphEntityIn)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "as_known")
delete(additionalProperties, "as_of")
delete(additionalProperties, "entity")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableGraphGraphEntityIn struct {
value *GraphGraphEntityIn
isSet bool
}
func (v NullableGraphGraphEntityIn) Get() *GraphGraphEntityIn {
return v.value
}
func (v *NullableGraphGraphEntityIn) Set(val *GraphGraphEntityIn) {
v.value = val
v.isSet = true
}
func (v NullableGraphGraphEntityIn) IsSet() bool {
return v.isSet
}
func (v *NullableGraphGraphEntityIn) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableGraphGraphEntityIn(val *GraphGraphEntityIn) *NullableGraphGraphEntityIn {
return &NullableGraphGraphEntityIn{value: val, isSet: true}
}
func (v NullableGraphGraphEntityIn) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableGraphGraphEntityIn) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}