Files
sdk/model_agent_tree_node.go

193 lines
5.4 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"
)
// checks if the AgentTreeNode type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AgentTreeNode{}
// AgentTreeNode struct for AgentTreeNode
type AgentTreeNode struct {
// Children is this node's direct children, each a whole node, so the array nests to the depth of the flow. A leaf carries null rather than an empty array. The subtree is materialised in full, up to 10000 nodes, out of one indexed read of the root; nothing is walked node by node.
Children []AgentTreeNode `json:"children,omitempty"`
// Session is this node's own session, carrying its event count and its direct fan-out. It is the same shape the list and detail reads answer with, minus the last-event preview, which the tree does not fetch.
Session *AgentSessionView `json:"session,omitempty"`
AdditionalProperties map[string]interface{}
}
type _AgentTreeNode AgentTreeNode
// NewAgentTreeNode instantiates a new AgentTreeNode 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 NewAgentTreeNode() *AgentTreeNode {
this := AgentTreeNode{}
return &this
}
// NewAgentTreeNodeWithDefaults instantiates a new AgentTreeNode 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 NewAgentTreeNodeWithDefaults() *AgentTreeNode {
this := AgentTreeNode{}
return &this
}
// GetChildren returns the Children field value if set, zero value otherwise.
func (o *AgentTreeNode) GetChildren() []AgentTreeNode {
if o == nil || IsNil(o.Children) {
var ret []AgentTreeNode
return ret
}
return o.Children
}
// GetChildrenOk returns a tuple with the Children field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AgentTreeNode) GetChildrenOk() ([]AgentTreeNode, bool) {
if o == nil || IsNil(o.Children) {
return nil, false
}
return o.Children, true
}
// HasChildren returns a boolean if a field has been set.
func (o *AgentTreeNode) HasChildren() bool {
if o != nil && !IsNil(o.Children) {
return true
}
return false
}
// SetChildren gets a reference to the given []AgentTreeNode and assigns it to the Children field.
func (o *AgentTreeNode) SetChildren(v []AgentTreeNode) {
o.Children = v
}
// GetSession returns the Session field value if set, zero value otherwise.
func (o *AgentTreeNode) GetSession() AgentSessionView {
if o == nil || IsNil(o.Session) {
var ret AgentSessionView
return ret
}
return *o.Session
}
// GetSessionOk returns a tuple with the Session field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AgentTreeNode) GetSessionOk() (*AgentSessionView, bool) {
if o == nil || IsNil(o.Session) {
return nil, false
}
return o.Session, true
}
// HasSession returns a boolean if a field has been set.
func (o *AgentTreeNode) HasSession() bool {
if o != nil && !IsNil(o.Session) {
return true
}
return false
}
// SetSession gets a reference to the given AgentSessionView and assigns it to the Session field.
func (o *AgentTreeNode) SetSession(v AgentSessionView) {
o.Session = &v
}
func (o AgentTreeNode) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o AgentTreeNode) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Children) {
toSerialize["children"] = o.Children
}
if !IsNil(o.Session) {
toSerialize["session"] = o.Session
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *AgentTreeNode) UnmarshalJSON(data []byte) (err error) {
varAgentTreeNode := _AgentTreeNode{}
err = json.Unmarshal(data, &varAgentTreeNode)
if err != nil {
return err
}
*o = AgentTreeNode(varAgentTreeNode)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "children")
delete(additionalProperties, "session")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableAgentTreeNode struct {
value *AgentTreeNode
isSet bool
}
func (v NullableAgentTreeNode) Get() *AgentTreeNode {
return v.value
}
func (v *NullableAgentTreeNode) Set(val *AgentTreeNode) {
v.value = val
v.isSet = true
}
func (v NullableAgentTreeNode) IsSet() bool {
return v.isSet
}
func (v *NullableAgentTreeNode) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAgentTreeNode(val *AgentTreeNode) *NullableAgentTreeNode {
return &NullableAgentTreeNode{value: val, isSet: true}
}
func (v NullableAgentTreeNode) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAgentTreeNode) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}