Files
sdk/model_openai_tool.go

191 lines
4.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"
)
// checks if the OpenaiTool type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &OpenaiTool{}
// OpenaiTool struct for OpenaiTool
type OpenaiTool struct {
Function *OpenaiFunctionDefinition `json:"function,omitempty"`
Type *string `json:"type,omitempty"`
AdditionalProperties map[string]interface{}
}
type _OpenaiTool OpenaiTool
// NewOpenaiTool instantiates a new OpenaiTool 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 NewOpenaiTool() *OpenaiTool {
this := OpenaiTool{}
return &this
}
// NewOpenaiToolWithDefaults instantiates a new OpenaiTool 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 NewOpenaiToolWithDefaults() *OpenaiTool {
this := OpenaiTool{}
return &this
}
// GetFunction returns the Function field value if set, zero value otherwise.
func (o *OpenaiTool) GetFunction() OpenaiFunctionDefinition {
if o == nil || IsNil(o.Function) {
var ret OpenaiFunctionDefinition
return ret
}
return *o.Function
}
// GetFunctionOk returns a tuple with the Function field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OpenaiTool) GetFunctionOk() (*OpenaiFunctionDefinition, bool) {
if o == nil || IsNil(o.Function) {
return nil, false
}
return o.Function, true
}
// HasFunction returns a boolean if a field has been set.
func (o *OpenaiTool) HasFunction() bool {
if o != nil && !IsNil(o.Function) {
return true
}
return false
}
// SetFunction gets a reference to the given OpenaiFunctionDefinition and assigns it to the Function field.
func (o *OpenaiTool) SetFunction(v OpenaiFunctionDefinition) {
o.Function = &v
}
// GetType returns the Type field value if set, zero value otherwise.
func (o *OpenaiTool) GetType() string {
if o == nil || IsNil(o.Type) {
var ret string
return ret
}
return *o.Type
}
// GetTypeOk returns a tuple with the Type field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OpenaiTool) GetTypeOk() (*string, bool) {
if o == nil || IsNil(o.Type) {
return nil, false
}
return o.Type, true
}
// HasType returns a boolean if a field has been set.
func (o *OpenaiTool) HasType() bool {
if o != nil && !IsNil(o.Type) {
return true
}
return false
}
// SetType gets a reference to the given string and assigns it to the Type field.
func (o *OpenaiTool) SetType(v string) {
o.Type = &v
}
func (o OpenaiTool) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o OpenaiTool) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Function) {
toSerialize["function"] = o.Function
}
if !IsNil(o.Type) {
toSerialize["type"] = o.Type
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *OpenaiTool) UnmarshalJSON(data []byte) (err error) {
varOpenaiTool := _OpenaiTool{}
err = json.Unmarshal(data, &varOpenaiTool)
if err != nil {
return err
}
*o = OpenaiTool(varOpenaiTool)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "function")
delete(additionalProperties, "type")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableOpenaiTool struct {
value *OpenaiTool
isSet bool
}
func (v NullableOpenaiTool) Get() *OpenaiTool {
return v.value
}
func (v *NullableOpenaiTool) Set(val *OpenaiTool) {
v.value = val
v.isSet = true
}
func (v NullableOpenaiTool) IsSet() bool {
return v.isSet
}
func (v *NullableOpenaiTool) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableOpenaiTool(val *OpenaiTool) *NullableOpenaiTool {
return &NullableOpenaiTool{value: val, isSet: true}
}
func (v NullableOpenaiTool) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableOpenaiTool) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}