Files
sdk/model_graph_graph_convo_in.go

266 lines
6.8 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 GraphGraphConvoIn type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &GraphGraphConvoIn{}
// GraphGraphConvoIn struct for GraphGraphConvoIn
type GraphGraphConvoIn struct {
// At is the default valid instant for any turn that omits its own At, RFC 3339. Required.
At string `json:"at"`
// DryRun when true returns the extracted assertions without writing them to the store. Absent or false files them through the assertion admission path.
DryRun *bool `json:"dry_run,omitempty"`
// Source names the conversation these turns came from, such as chat/thread-42. Required.
Source string `json:"source"`
// Turns is the ordered dialogue turns to read. Required.
Turns []GraphGraphTurn `json:"turns"`
AdditionalProperties map[string]interface{}
}
type _GraphGraphConvoIn GraphGraphConvoIn
// NewGraphGraphConvoIn instantiates a new GraphGraphConvoIn 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 NewGraphGraphConvoIn(at string, source string, turns []GraphGraphTurn) *GraphGraphConvoIn {
this := GraphGraphConvoIn{}
this.At = at
this.Source = source
this.Turns = turns
return &this
}
// NewGraphGraphConvoInWithDefaults instantiates a new GraphGraphConvoIn 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 NewGraphGraphConvoInWithDefaults() *GraphGraphConvoIn {
this := GraphGraphConvoIn{}
return &this
}
// GetAt returns the At field value
func (o *GraphGraphConvoIn) 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 *GraphGraphConvoIn) GetAtOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.At, true
}
// SetAt sets field value
func (o *GraphGraphConvoIn) SetAt(v string) {
o.At = v
}
// GetDryRun returns the DryRun field value if set, zero value otherwise.
func (o *GraphGraphConvoIn) GetDryRun() bool {
if o == nil || IsNil(o.DryRun) {
var ret bool
return ret
}
return *o.DryRun
}
// GetDryRunOk returns a tuple with the DryRun field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GraphGraphConvoIn) GetDryRunOk() (*bool, bool) {
if o == nil || IsNil(o.DryRun) {
return nil, false
}
return o.DryRun, true
}
// HasDryRun returns a boolean if a field has been set.
func (o *GraphGraphConvoIn) HasDryRun() bool {
if o != nil && !IsNil(o.DryRun) {
return true
}
return false
}
// SetDryRun gets a reference to the given bool and assigns it to the DryRun field.
func (o *GraphGraphConvoIn) SetDryRun(v bool) {
o.DryRun = &v
}
// GetSource returns the Source field value
func (o *GraphGraphConvoIn) 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 *GraphGraphConvoIn) GetSourceOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Source, true
}
// SetSource sets field value
func (o *GraphGraphConvoIn) SetSource(v string) {
o.Source = v
}
// GetTurns returns the Turns field value
func (o *GraphGraphConvoIn) GetTurns() []GraphGraphTurn {
if o == nil {
var ret []GraphGraphTurn
return ret
}
return o.Turns
}
// GetTurnsOk returns a tuple with the Turns field value
// and a boolean to check if the value has been set.
func (o *GraphGraphConvoIn) GetTurnsOk() ([]GraphGraphTurn, bool) {
if o == nil {
return nil, false
}
return o.Turns, true
}
// SetTurns sets field value
func (o *GraphGraphConvoIn) SetTurns(v []GraphGraphTurn) {
o.Turns = v
}
func (o GraphGraphConvoIn) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o GraphGraphConvoIn) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["at"] = o.At
if !IsNil(o.DryRun) {
toSerialize["dry_run"] = o.DryRun
}
toSerialize["source"] = o.Source
toSerialize["turns"] = o.Turns
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *GraphGraphConvoIn) 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",
"source",
"turns",
}
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)
}
}
varGraphGraphConvoIn := _GraphGraphConvoIn{}
err = json.Unmarshal(data, &varGraphGraphConvoIn)
if err != nil {
return err
}
*o = GraphGraphConvoIn(varGraphGraphConvoIn)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "at")
delete(additionalProperties, "dry_run")
delete(additionalProperties, "source")
delete(additionalProperties, "turns")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableGraphGraphConvoIn struct {
value *GraphGraphConvoIn
isSet bool
}
func (v NullableGraphGraphConvoIn) Get() *GraphGraphConvoIn {
return v.value
}
func (v *NullableGraphGraphConvoIn) Set(val *GraphGraphConvoIn) {
v.value = val
v.isSet = true
}
func (v NullableGraphGraphConvoIn) IsSet() bool {
return v.isSet
}
func (v *NullableGraphGraphConvoIn) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableGraphGraphConvoIn(val *GraphGraphConvoIn) *NullableGraphGraphConvoIn {
return &NullableGraphGraphConvoIn{value: val, isSet: true}
}
func (v NullableGraphGraphConvoIn) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableGraphGraphConvoIn) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}