Files
sdk/model_graph_graph_source_in.go

274 lines
7.7 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 GraphGraphSourceIn type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &GraphGraphSourceIn{}
// GraphGraphSourceIn struct for GraphGraphSourceIn
type GraphGraphSourceIn struct {
// At is when what the source says was so, RFC 3339. Required by ingest — which records — and read by nothing in extract, which records nothing. Required for the same reason /v1/graph requires it: it is part of the assertion's content address, so re-reading one source at one instant records one set of rows however many times it is delivered. A clock read here instead would append the whole document again on every re-read.
At *string `json:"at,omitempty"`
// Source names where the text came from — a URL, a document id, a page title. It is stamped on every assertion as its source, and with the section number as its evidence, so a claim can be traced back to the passage that made it. Required.
Source string `json:"source"`
// Subject is the entity the text is about before any heading names one. A document that states relations above its first heading needs it; one whose every section is headed does not.
Subject *string `json:"subject,omitempty"`
// Text is the document. Relations are read from it and from nothing else: a line written `relation:: value` states one, and prose states none. Required.
Text string `json:"text"`
AdditionalProperties map[string]interface{}
}
type _GraphGraphSourceIn GraphGraphSourceIn
// NewGraphGraphSourceIn instantiates a new GraphGraphSourceIn 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 NewGraphGraphSourceIn(source string, text string) *GraphGraphSourceIn {
this := GraphGraphSourceIn{}
this.Source = source
this.Text = text
return &this
}
// NewGraphGraphSourceInWithDefaults instantiates a new GraphGraphSourceIn 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 NewGraphGraphSourceInWithDefaults() *GraphGraphSourceIn {
this := GraphGraphSourceIn{}
return &this
}
// GetAt returns the At field value if set, zero value otherwise.
func (o *GraphGraphSourceIn) GetAt() string {
if o == nil || IsNil(o.At) {
var ret string
return ret
}
return *o.At
}
// GetAtOk returns a tuple with the At field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GraphGraphSourceIn) GetAtOk() (*string, bool) {
if o == nil || IsNil(o.At) {
return nil, false
}
return o.At, true
}
// HasAt returns a boolean if a field has been set.
func (o *GraphGraphSourceIn) HasAt() bool {
if o != nil && !IsNil(o.At) {
return true
}
return false
}
// SetAt gets a reference to the given string and assigns it to the At field.
func (o *GraphGraphSourceIn) SetAt(v string) {
o.At = &v
}
// GetSource returns the Source field value
func (o *GraphGraphSourceIn) 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 *GraphGraphSourceIn) GetSourceOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Source, true
}
// SetSource sets field value
func (o *GraphGraphSourceIn) SetSource(v string) {
o.Source = v
}
// GetSubject returns the Subject field value if set, zero value otherwise.
func (o *GraphGraphSourceIn) GetSubject() string {
if o == nil || IsNil(o.Subject) {
var ret string
return ret
}
return *o.Subject
}
// GetSubjectOk returns a tuple with the Subject field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GraphGraphSourceIn) GetSubjectOk() (*string, bool) {
if o == nil || IsNil(o.Subject) {
return nil, false
}
return o.Subject, true
}
// HasSubject returns a boolean if a field has been set.
func (o *GraphGraphSourceIn) HasSubject() bool {
if o != nil && !IsNil(o.Subject) {
return true
}
return false
}
// SetSubject gets a reference to the given string and assigns it to the Subject field.
func (o *GraphGraphSourceIn) SetSubject(v string) {
o.Subject = &v
}
// GetText returns the Text field value
func (o *GraphGraphSourceIn) GetText() string {
if o == nil {
var ret string
return ret
}
return o.Text
}
// GetTextOk returns a tuple with the Text field value
// and a boolean to check if the value has been set.
func (o *GraphGraphSourceIn) GetTextOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Text, true
}
// SetText sets field value
func (o *GraphGraphSourceIn) SetText(v string) {
o.Text = v
}
func (o GraphGraphSourceIn) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o GraphGraphSourceIn) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.At) {
toSerialize["at"] = o.At
}
toSerialize["source"] = o.Source
if !IsNil(o.Subject) {
toSerialize["subject"] = o.Subject
}
toSerialize["text"] = o.Text
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *GraphGraphSourceIn) 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{
"source",
"text",
}
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)
}
}
varGraphGraphSourceIn := _GraphGraphSourceIn{}
err = json.Unmarshal(data, &varGraphGraphSourceIn)
if err != nil {
return err
}
*o = GraphGraphSourceIn(varGraphGraphSourceIn)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "at")
delete(additionalProperties, "source")
delete(additionalProperties, "subject")
delete(additionalProperties, "text")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableGraphGraphSourceIn struct {
value *GraphGraphSourceIn
isSet bool
}
func (v NullableGraphGraphSourceIn) Get() *GraphGraphSourceIn {
return v.value
}
func (v *NullableGraphGraphSourceIn) Set(val *GraphGraphSourceIn) {
v.value = val
v.isSet = true
}
func (v NullableGraphGraphSourceIn) IsSet() bool {
return v.isSet
}
func (v *NullableGraphGraphSourceIn) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableGraphGraphSourceIn(val *GraphGraphSourceIn) *NullableGraphGraphSourceIn {
return &NullableGraphGraphSourceIn{value: val, isSet: true}
}
func (v NullableGraphGraphSourceIn) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableGraphGraphSourceIn) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}