Files
sdk/model_graph_graph_turn.go

312 lines
7.9 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 GraphGraphTurn type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &GraphGraphTurn{}
// GraphGraphTurn struct for GraphGraphTurn
type GraphGraphTurn struct {
// At is when this turn was spoken, RFC 3339. Absent defaults to the conversation's At instant.
At *string `json:"at,omitempty"`
// ID is the turn's identifier within the conversation, appended to Source as `#<id>` in Evidence. Absent defaults to its 1-based position.
Id *string `json:"id,omitempty"`
// Partner is the entity key of the participant addressed in this turn. Second-person references (you, your) resolve to Partner.
Partner *string `json:"partner,omitempty"`
// Speaker is the entity key of the participant speaking this turn. First- person references (I, me, my) resolve to Speaker. Required.
Speaker string `json:"speaker"`
// Text is what the speaker said. Required.
Text string `json:"text"`
AdditionalProperties map[string]interface{}
}
type _GraphGraphTurn GraphGraphTurn
// NewGraphGraphTurn instantiates a new GraphGraphTurn 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 NewGraphGraphTurn(speaker string, text string) *GraphGraphTurn {
this := GraphGraphTurn{}
this.Speaker = speaker
this.Text = text
return &this
}
// NewGraphGraphTurnWithDefaults instantiates a new GraphGraphTurn 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 NewGraphGraphTurnWithDefaults() *GraphGraphTurn {
this := GraphGraphTurn{}
return &this
}
// GetAt returns the At field value if set, zero value otherwise.
func (o *GraphGraphTurn) 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 *GraphGraphTurn) 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 *GraphGraphTurn) 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 *GraphGraphTurn) SetAt(v string) {
o.At = &v
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *GraphGraphTurn) GetId() string {
if o == nil || IsNil(o.Id) {
var ret string
return ret
}
return *o.Id
}
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GraphGraphTurn) GetIdOk() (*string, bool) {
if o == nil || IsNil(o.Id) {
return nil, false
}
return o.Id, true
}
// HasId returns a boolean if a field has been set.
func (o *GraphGraphTurn) HasId() bool {
if o != nil && !IsNil(o.Id) {
return true
}
return false
}
// SetId gets a reference to the given string and assigns it to the Id field.
func (o *GraphGraphTurn) SetId(v string) {
o.Id = &v
}
// GetPartner returns the Partner field value if set, zero value otherwise.
func (o *GraphGraphTurn) GetPartner() string {
if o == nil || IsNil(o.Partner) {
var ret string
return ret
}
return *o.Partner
}
// GetPartnerOk returns a tuple with the Partner field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GraphGraphTurn) GetPartnerOk() (*string, bool) {
if o == nil || IsNil(o.Partner) {
return nil, false
}
return o.Partner, true
}
// HasPartner returns a boolean if a field has been set.
func (o *GraphGraphTurn) HasPartner() bool {
if o != nil && !IsNil(o.Partner) {
return true
}
return false
}
// SetPartner gets a reference to the given string and assigns it to the Partner field.
func (o *GraphGraphTurn) SetPartner(v string) {
o.Partner = &v
}
// GetSpeaker returns the Speaker field value
func (o *GraphGraphTurn) GetSpeaker() string {
if o == nil {
var ret string
return ret
}
return o.Speaker
}
// GetSpeakerOk returns a tuple with the Speaker field value
// and a boolean to check if the value has been set.
func (o *GraphGraphTurn) GetSpeakerOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Speaker, true
}
// SetSpeaker sets field value
func (o *GraphGraphTurn) SetSpeaker(v string) {
o.Speaker = v
}
// GetText returns the Text field value
func (o *GraphGraphTurn) 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 *GraphGraphTurn) GetTextOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Text, true
}
// SetText sets field value
func (o *GraphGraphTurn) SetText(v string) {
o.Text = v
}
func (o GraphGraphTurn) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o GraphGraphTurn) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.At) {
toSerialize["at"] = o.At
}
if !IsNil(o.Id) {
toSerialize["id"] = o.Id
}
if !IsNil(o.Partner) {
toSerialize["partner"] = o.Partner
}
toSerialize["speaker"] = o.Speaker
toSerialize["text"] = o.Text
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *GraphGraphTurn) 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{
"speaker",
"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)
}
}
varGraphGraphTurn := _GraphGraphTurn{}
err = json.Unmarshal(data, &varGraphGraphTurn)
if err != nil {
return err
}
*o = GraphGraphTurn(varGraphGraphTurn)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "at")
delete(additionalProperties, "id")
delete(additionalProperties, "partner")
delete(additionalProperties, "speaker")
delete(additionalProperties, "text")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableGraphGraphTurn struct {
value *GraphGraphTurn
isSet bool
}
func (v NullableGraphGraphTurn) Get() *GraphGraphTurn {
return v.value
}
func (v *NullableGraphGraphTurn) Set(val *GraphGraphTurn) {
v.value = val
v.isSet = true
}
func (v NullableGraphGraphTurn) IsSet() bool {
return v.isSet
}
func (v *NullableGraphGraphTurn) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableGraphGraphTurn(val *GraphGraphTurn) *NullableGraphGraphTurn {
return &NullableGraphGraphTurn{value: val, isSet: true}
}
func (v NullableGraphGraphTurn) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableGraphGraphTurn) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}