Files
sdk/model_graph_graph_fact.go

486 lines
14 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 GraphGraphFact type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &GraphGraphFact{}
// GraphGraphFact struct for GraphGraphFact
type GraphGraphFact struct {
// At is when the thing was so, RFC 3339. Required, and refused when it sits more than five minutes ahead of the server clock — an assertion dated further out would never mature and would skew every read until it did.
At string `json:"at"`
// Confidence in [0,1]. A tie-breaker within the order, never a substitute for it. Absent is 0, the weakest an assertion can be.
Confidence *float64 `json:"confidence,omitempty"`
// Entity is the thing being described, in the organization's own namespace. It is not created: an entity exists because something was asserted about it. It is a key, folded to Unicode NFC with control characters removed, so two spellings of one name are one entity. An entity named `relation:<name>` is that relation's declaration and one named `rule:<name>` is a rule (graphDerive), and only an admin of the organization may assert anything of either. Required, 512 bytes at most.
Entity string `json:"entity"`
// Evidence points at the record this claim came from, 512 bytes at most. An assertion without one is admitted and carries no defence.
Evidence *string `json:"evidence,omitempty"`
// Names says the value is an entity. A walk reads only the edges, so this is a declaration and never a guess about the value's shape.
Names *bool `json:"names,omitempty"`
// Relation is what is being asserted — `depends`, `owner`, `same`, `title` — and a key, folded as Entity is. It is open until the organization declares it: once `relation:<name>` has a `domain` or `range` in force, the entity's `type` (and, for range, the value's) must match it. Required, 128 bytes at most.
Relation string `json:"relation"`
// Seen is when this assertion became knowable, RFC 3339. Defaults to At and may not precede it. It is provenance and it decides nothing: the instant every read uses is derived as the later of Seen and the server's own clock.
Seen *string `json:"seen,omitempty"`
// Source names who asserted. Required, because an assertion nobody is named for cannot be weighed against one that is. Open text: this plane ranks no source above another.
Source string `json:"source"`
// Until is when the thing stopped being so, RFC 3339, and must follow At. Absent is open: the statement holds until something ends it. A term of office, an employment, a membership are At and Until on one statement.
Until *string `json:"until,omitempty"`
// Value is what the relation points at. When Names is true it is another entity's key, folded as Entity is, and the assertion is an EDGE; otherwise it is a scalar, kept byte for byte, and the assertion is a property. 2048 bytes at most, or 512 when it names an entity.
Value *string `json:"value,omitempty"`
AdditionalProperties map[string]interface{}
}
type _GraphGraphFact GraphGraphFact
// NewGraphGraphFact instantiates a new GraphGraphFact 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 NewGraphGraphFact(at string, entity string, relation string, source string) *GraphGraphFact {
this := GraphGraphFact{}
this.At = at
this.Entity = entity
this.Relation = relation
this.Source = source
return &this
}
// NewGraphGraphFactWithDefaults instantiates a new GraphGraphFact 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 NewGraphGraphFactWithDefaults() *GraphGraphFact {
this := GraphGraphFact{}
return &this
}
// GetAt returns the At field value
func (o *GraphGraphFact) GetAt() string {
if o == nil {
var ret string
return ret
}
return o.At
}
// GetAtOk returns a tuple with the At field value
// and a boolean to check if the value has been set.
func (o *GraphGraphFact) GetAtOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.At, true
}
// SetAt sets field value
func (o *GraphGraphFact) SetAt(v string) {
o.At = v
}
// GetConfidence returns the Confidence field value if set, zero value otherwise.
func (o *GraphGraphFact) GetConfidence() float64 {
if o == nil || IsNil(o.Confidence) {
var ret float64
return ret
}
return *o.Confidence
}
// GetConfidenceOk returns a tuple with the Confidence field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GraphGraphFact) GetConfidenceOk() (*float64, bool) {
if o == nil || IsNil(o.Confidence) {
return nil, false
}
return o.Confidence, true
}
// HasConfidence returns a boolean if a field has been set.
func (o *GraphGraphFact) HasConfidence() bool {
if o != nil && !IsNil(o.Confidence) {
return true
}
return false
}
// SetConfidence gets a reference to the given float64 and assigns it to the Confidence field.
func (o *GraphGraphFact) SetConfidence(v float64) {
o.Confidence = &v
}
// GetEntity returns the Entity field value
func (o *GraphGraphFact) 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 *GraphGraphFact) GetEntityOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Entity, true
}
// SetEntity sets field value
func (o *GraphGraphFact) SetEntity(v string) {
o.Entity = v
}
// GetEvidence returns the Evidence field value if set, zero value otherwise.
func (o *GraphGraphFact) GetEvidence() string {
if o == nil || IsNil(o.Evidence) {
var ret string
return ret
}
return *o.Evidence
}
// GetEvidenceOk returns a tuple with the Evidence field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GraphGraphFact) GetEvidenceOk() (*string, bool) {
if o == nil || IsNil(o.Evidence) {
return nil, false
}
return o.Evidence, true
}
// HasEvidence returns a boolean if a field has been set.
func (o *GraphGraphFact) HasEvidence() bool {
if o != nil && !IsNil(o.Evidence) {
return true
}
return false
}
// SetEvidence gets a reference to the given string and assigns it to the Evidence field.
func (o *GraphGraphFact) SetEvidence(v string) {
o.Evidence = &v
}
// GetNames returns the Names field value if set, zero value otherwise.
func (o *GraphGraphFact) GetNames() bool {
if o == nil || IsNil(o.Names) {
var ret bool
return ret
}
return *o.Names
}
// GetNamesOk returns a tuple with the Names field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GraphGraphFact) GetNamesOk() (*bool, bool) {
if o == nil || IsNil(o.Names) {
return nil, false
}
return o.Names, true
}
// HasNames returns a boolean if a field has been set.
func (o *GraphGraphFact) HasNames() bool {
if o != nil && !IsNil(o.Names) {
return true
}
return false
}
// SetNames gets a reference to the given bool and assigns it to the Names field.
func (o *GraphGraphFact) SetNames(v bool) {
o.Names = &v
}
// GetRelation returns the Relation field value
func (o *GraphGraphFact) GetRelation() string {
if o == nil {
var ret string
return ret
}
return o.Relation
}
// GetRelationOk returns a tuple with the Relation field value
// and a boolean to check if the value has been set.
func (o *GraphGraphFact) GetRelationOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Relation, true
}
// SetRelation sets field value
func (o *GraphGraphFact) SetRelation(v string) {
o.Relation = v
}
// GetSeen returns the Seen field value if set, zero value otherwise.
func (o *GraphGraphFact) GetSeen() string {
if o == nil || IsNil(o.Seen) {
var ret string
return ret
}
return *o.Seen
}
// GetSeenOk returns a tuple with the Seen field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GraphGraphFact) GetSeenOk() (*string, bool) {
if o == nil || IsNil(o.Seen) {
return nil, false
}
return o.Seen, true
}
// HasSeen returns a boolean if a field has been set.
func (o *GraphGraphFact) HasSeen() bool {
if o != nil && !IsNil(o.Seen) {
return true
}
return false
}
// SetSeen gets a reference to the given string and assigns it to the Seen field.
func (o *GraphGraphFact) SetSeen(v string) {
o.Seen = &v
}
// GetSource returns the Source field value
func (o *GraphGraphFact) GetSource() string {
if o == nil {
var ret string
return ret
}
return o.Source
}
// GetSourceOk returns a tuple with the Source field value
// and a boolean to check if the value has been set.
func (o *GraphGraphFact) GetSourceOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Source, true
}
// SetSource sets field value
func (o *GraphGraphFact) SetSource(v string) {
o.Source = v
}
// GetUntil returns the Until field value if set, zero value otherwise.
func (o *GraphGraphFact) GetUntil() string {
if o == nil || IsNil(o.Until) {
var ret string
return ret
}
return *o.Until
}
// GetUntilOk returns a tuple with the Until field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GraphGraphFact) GetUntilOk() (*string, bool) {
if o == nil || IsNil(o.Until) {
return nil, false
}
return o.Until, true
}
// HasUntil returns a boolean if a field has been set.
func (o *GraphGraphFact) HasUntil() bool {
if o != nil && !IsNil(o.Until) {
return true
}
return false
}
// SetUntil gets a reference to the given string and assigns it to the Until field.
func (o *GraphGraphFact) SetUntil(v string) {
o.Until = &v
}
// GetValue returns the Value field value if set, zero value otherwise.
func (o *GraphGraphFact) GetValue() string {
if o == nil || IsNil(o.Value) {
var ret string
return ret
}
return *o.Value
}
// GetValueOk returns a tuple with the Value field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GraphGraphFact) GetValueOk() (*string, bool) {
if o == nil || IsNil(o.Value) {
return nil, false
}
return o.Value, true
}
// HasValue returns a boolean if a field has been set.
func (o *GraphGraphFact) HasValue() bool {
if o != nil && !IsNil(o.Value) {
return true
}
return false
}
// SetValue gets a reference to the given string and assigns it to the Value field.
func (o *GraphGraphFact) SetValue(v string) {
o.Value = &v
}
func (o GraphGraphFact) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o GraphGraphFact) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["at"] = o.At
if !IsNil(o.Confidence) {
toSerialize["confidence"] = o.Confidence
}
toSerialize["entity"] = o.Entity
if !IsNil(o.Evidence) {
toSerialize["evidence"] = o.Evidence
}
if !IsNil(o.Names) {
toSerialize["names"] = o.Names
}
toSerialize["relation"] = o.Relation
if !IsNil(o.Seen) {
toSerialize["seen"] = o.Seen
}
toSerialize["source"] = o.Source
if !IsNil(o.Until) {
toSerialize["until"] = o.Until
}
if !IsNil(o.Value) {
toSerialize["value"] = o.Value
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *GraphGraphFact) 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{
"at",
"entity",
"relation",
"source",
}
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)
}
}
varGraphGraphFact := _GraphGraphFact{}
err = json.Unmarshal(data, &varGraphGraphFact)
if err != nil {
return err
}
*o = GraphGraphFact(varGraphGraphFact)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "at")
delete(additionalProperties, "confidence")
delete(additionalProperties, "entity")
delete(additionalProperties, "evidence")
delete(additionalProperties, "names")
delete(additionalProperties, "relation")
delete(additionalProperties, "seen")
delete(additionalProperties, "source")
delete(additionalProperties, "until")
delete(additionalProperties, "value")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableGraphGraphFact struct {
value *GraphGraphFact
isSet bool
}
func (v NullableGraphGraphFact) Get() *GraphGraphFact {
return v.value
}
func (v *NullableGraphGraphFact) Set(val *GraphGraphFact) {
v.value = val
v.isSet = true
}
func (v NullableGraphGraphFact) IsSet() bool {
return v.isSet
}
func (v *NullableGraphGraphFact) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableGraphGraphFact(val *GraphGraphFact) *NullableGraphGraphFact {
return &NullableGraphGraphFact{value: val, isSet: true}
}
func (v NullableGraphGraphFact) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableGraphGraphFact) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}