Files
sdk/model_graph_graph_apple_triple.go

494 lines
15 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 GraphGraphAppleTriple type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &GraphGraphAppleTriple{}
// GraphGraphAppleTriple struct for GraphGraphAppleTriple
type GraphGraphAppleTriple struct {
// Confidence is the daemon's certainty in [0,1]. Absent defaults to 1 for copied facts and 0 for unscored rows.
Confidence *float64 `json:"confidence,omitempty"`
// Object is the target entity identifier, class code or scalar literal. Required.
Object string `json:"object"`
// Predicate is the predicate code, such as PS1, PS33, PS500 or PS598. Required.
Predicate string `json:"predicate"`
// RelationshipID groups the two rows of a reified edge in stable_graph: one row with RelationshipPredicate PS1 naming the CS*_/nm_* relationship class, and a companion row naming the target entity or value. Absent on single-row triples.
RelationshipId *string `json:"relationship_id,omitempty"`
// RelationshipPredicate is the sub-predicate on a reified edge row, such as PS1 for the relationship class or PS45 for the target entity. Absent on single-row triples.
RelationshipPredicate *string `json:"relationship_predicate,omitempty"`
// SourceDuplicates is how many duplicate source records backed the row.
SourceDuplicates *int64 `json:"source_duplicates,omitempty"`
// Sources names the OS stores that contributed the row, such as Contacts, Calendar, Photos or Family Sharing. Absent defaults to apple/graph.db.
Sources *string `json:"sources,omitempty"`
// Subject is the source entity identifier in graph.db, such as 9100000000007919. Required.
Subject string `json:"subject"`
// Timestamp is when the daemon recorded the row, RFC 3339. Absent defaults to the batch's At instant.
Timestamp *string `json:"timestamp,omitempty"`
// Until is when a withdrawn row in expired_stable_graph stopped holding, RFC 3339. Absent on expired rows defaults to the batch's At instant.
Until *string `json:"until,omitempty"`
AdditionalProperties map[string]interface{}
}
type _GraphGraphAppleTriple GraphGraphAppleTriple
// NewGraphGraphAppleTriple instantiates a new GraphGraphAppleTriple 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 NewGraphGraphAppleTriple(object string, predicate string, subject string) *GraphGraphAppleTriple {
this := GraphGraphAppleTriple{}
this.Object = object
this.Predicate = predicate
this.Subject = subject
return &this
}
// NewGraphGraphAppleTripleWithDefaults instantiates a new GraphGraphAppleTriple 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 NewGraphGraphAppleTripleWithDefaults() *GraphGraphAppleTriple {
this := GraphGraphAppleTriple{}
return &this
}
// GetConfidence returns the Confidence field value if set, zero value otherwise.
func (o *GraphGraphAppleTriple) 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 *GraphGraphAppleTriple) 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 *GraphGraphAppleTriple) 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 *GraphGraphAppleTriple) SetConfidence(v float64) {
o.Confidence = &v
}
// GetObject returns the Object field value
func (o *GraphGraphAppleTriple) GetObject() string {
if o == nil {
var ret string
return ret
}
return o.Object
}
// GetObjectOk returns a tuple with the Object field value
// and a boolean to check if the value has been set.
func (o *GraphGraphAppleTriple) GetObjectOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Object, true
}
// SetObject sets field value
func (o *GraphGraphAppleTriple) SetObject(v string) {
o.Object = v
}
// GetPredicate returns the Predicate field value
func (o *GraphGraphAppleTriple) GetPredicate() string {
if o == nil {
var ret string
return ret
}
return o.Predicate
}
// GetPredicateOk returns a tuple with the Predicate field value
// and a boolean to check if the value has been set.
func (o *GraphGraphAppleTriple) GetPredicateOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Predicate, true
}
// SetPredicate sets field value
func (o *GraphGraphAppleTriple) SetPredicate(v string) {
o.Predicate = v
}
// GetRelationshipId returns the RelationshipId field value if set, zero value otherwise.
func (o *GraphGraphAppleTriple) GetRelationshipId() string {
if o == nil || IsNil(o.RelationshipId) {
var ret string
return ret
}
return *o.RelationshipId
}
// GetRelationshipIdOk returns a tuple with the RelationshipId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GraphGraphAppleTriple) GetRelationshipIdOk() (*string, bool) {
if o == nil || IsNil(o.RelationshipId) {
return nil, false
}
return o.RelationshipId, true
}
// HasRelationshipId returns a boolean if a field has been set.
func (o *GraphGraphAppleTriple) HasRelationshipId() bool {
if o != nil && !IsNil(o.RelationshipId) {
return true
}
return false
}
// SetRelationshipId gets a reference to the given string and assigns it to the RelationshipId field.
func (o *GraphGraphAppleTriple) SetRelationshipId(v string) {
o.RelationshipId = &v
}
// GetRelationshipPredicate returns the RelationshipPredicate field value if set, zero value otherwise.
func (o *GraphGraphAppleTriple) GetRelationshipPredicate() string {
if o == nil || IsNil(o.RelationshipPredicate) {
var ret string
return ret
}
return *o.RelationshipPredicate
}
// GetRelationshipPredicateOk returns a tuple with the RelationshipPredicate field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GraphGraphAppleTriple) GetRelationshipPredicateOk() (*string, bool) {
if o == nil || IsNil(o.RelationshipPredicate) {
return nil, false
}
return o.RelationshipPredicate, true
}
// HasRelationshipPredicate returns a boolean if a field has been set.
func (o *GraphGraphAppleTriple) HasRelationshipPredicate() bool {
if o != nil && !IsNil(o.RelationshipPredicate) {
return true
}
return false
}
// SetRelationshipPredicate gets a reference to the given string and assigns it to the RelationshipPredicate field.
func (o *GraphGraphAppleTriple) SetRelationshipPredicate(v string) {
o.RelationshipPredicate = &v
}
// GetSourceDuplicates returns the SourceDuplicates field value if set, zero value otherwise.
func (o *GraphGraphAppleTriple) GetSourceDuplicates() int64 {
if o == nil || IsNil(o.SourceDuplicates) {
var ret int64
return ret
}
return *o.SourceDuplicates
}
// GetSourceDuplicatesOk returns a tuple with the SourceDuplicates field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GraphGraphAppleTriple) GetSourceDuplicatesOk() (*int64, bool) {
if o == nil || IsNil(o.SourceDuplicates) {
return nil, false
}
return o.SourceDuplicates, true
}
// HasSourceDuplicates returns a boolean if a field has been set.
func (o *GraphGraphAppleTriple) HasSourceDuplicates() bool {
if o != nil && !IsNil(o.SourceDuplicates) {
return true
}
return false
}
// SetSourceDuplicates gets a reference to the given int64 and assigns it to the SourceDuplicates field.
func (o *GraphGraphAppleTriple) SetSourceDuplicates(v int64) {
o.SourceDuplicates = &v
}
// GetSources returns the Sources field value if set, zero value otherwise.
func (o *GraphGraphAppleTriple) GetSources() string {
if o == nil || IsNil(o.Sources) {
var ret string
return ret
}
return *o.Sources
}
// GetSourcesOk returns a tuple with the Sources field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GraphGraphAppleTriple) GetSourcesOk() (*string, bool) {
if o == nil || IsNil(o.Sources) {
return nil, false
}
return o.Sources, true
}
// HasSources returns a boolean if a field has been set.
func (o *GraphGraphAppleTriple) HasSources() bool {
if o != nil && !IsNil(o.Sources) {
return true
}
return false
}
// SetSources gets a reference to the given string and assigns it to the Sources field.
func (o *GraphGraphAppleTriple) SetSources(v string) {
o.Sources = &v
}
// GetSubject returns the Subject field value
func (o *GraphGraphAppleTriple) GetSubject() string {
if o == nil {
var ret string
return ret
}
return o.Subject
}
// GetSubjectOk returns a tuple with the Subject field value
// and a boolean to check if the value has been set.
func (o *GraphGraphAppleTriple) GetSubjectOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Subject, true
}
// SetSubject sets field value
func (o *GraphGraphAppleTriple) SetSubject(v string) {
o.Subject = v
}
// GetTimestamp returns the Timestamp field value if set, zero value otherwise.
func (o *GraphGraphAppleTriple) GetTimestamp() string {
if o == nil || IsNil(o.Timestamp) {
var ret string
return ret
}
return *o.Timestamp
}
// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GraphGraphAppleTriple) GetTimestampOk() (*string, bool) {
if o == nil || IsNil(o.Timestamp) {
return nil, false
}
return o.Timestamp, true
}
// HasTimestamp returns a boolean if a field has been set.
func (o *GraphGraphAppleTriple) HasTimestamp() bool {
if o != nil && !IsNil(o.Timestamp) {
return true
}
return false
}
// SetTimestamp gets a reference to the given string and assigns it to the Timestamp field.
func (o *GraphGraphAppleTriple) SetTimestamp(v string) {
o.Timestamp = &v
}
// GetUntil returns the Until field value if set, zero value otherwise.
func (o *GraphGraphAppleTriple) 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 *GraphGraphAppleTriple) 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 *GraphGraphAppleTriple) 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 *GraphGraphAppleTriple) SetUntil(v string) {
o.Until = &v
}
func (o GraphGraphAppleTriple) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o GraphGraphAppleTriple) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Confidence) {
toSerialize["confidence"] = o.Confidence
}
toSerialize["object"] = o.Object
toSerialize["predicate"] = o.Predicate
if !IsNil(o.RelationshipId) {
toSerialize["relationship_id"] = o.RelationshipId
}
if !IsNil(o.RelationshipPredicate) {
toSerialize["relationship_predicate"] = o.RelationshipPredicate
}
if !IsNil(o.SourceDuplicates) {
toSerialize["source_duplicates"] = o.SourceDuplicates
}
if !IsNil(o.Sources) {
toSerialize["sources"] = o.Sources
}
toSerialize["subject"] = o.Subject
if !IsNil(o.Timestamp) {
toSerialize["timestamp"] = o.Timestamp
}
if !IsNil(o.Until) {
toSerialize["until"] = o.Until
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *GraphGraphAppleTriple) 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{
"object",
"predicate",
"subject",
}
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)
}
}
varGraphGraphAppleTriple := _GraphGraphAppleTriple{}
err = json.Unmarshal(data, &varGraphGraphAppleTriple)
if err != nil {
return err
}
*o = GraphGraphAppleTriple(varGraphGraphAppleTriple)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "confidence")
delete(additionalProperties, "object")
delete(additionalProperties, "predicate")
delete(additionalProperties, "relationship_id")
delete(additionalProperties, "relationship_predicate")
delete(additionalProperties, "source_duplicates")
delete(additionalProperties, "sources")
delete(additionalProperties, "subject")
delete(additionalProperties, "timestamp")
delete(additionalProperties, "until")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableGraphGraphAppleTriple struct {
value *GraphGraphAppleTriple
isSet bool
}
func (v NullableGraphGraphAppleTriple) Get() *GraphGraphAppleTriple {
return v.value
}
func (v *NullableGraphGraphAppleTriple) Set(val *GraphGraphAppleTriple) {
v.value = val
v.isSet = true
}
func (v NullableGraphGraphAppleTriple) IsSet() bool {
return v.isSet
}
func (v *NullableGraphGraphAppleTriple) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableGraphGraphAppleTriple(val *GraphGraphAppleTriple) *NullableGraphGraphAppleTriple {
return &NullableGraphGraphAppleTriple{value: val, isSet: true}
}
func (v NullableGraphGraphAppleTriple) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableGraphGraphAppleTriple) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}