Class: Vapi::CreateToolTemplateDto

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/create_tool_template_dto.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, details: OMIT, provider_details: OMIT, metadata: OMIT, visibility: OMIT, name: OMIT, provider: OMIT, additional_properties: nil) ⇒ Vapi::CreateToolTemplateDto

Parameters:



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/vapi_server_sdk/types/create_tool_template_dto.rb', line 44

def initialize(type:, details: OMIT, provider_details: OMIT, metadata: OMIT, visibility: OMIT, name: OMIT,
               provider: OMIT, additional_properties: nil)
  @details = details if details != OMIT
  @provider_details = provider_details if provider_details != OMIT
  @metadata =  if  != OMIT
  @visibility = visibility if visibility != OMIT
  @type = type
  @name = name if name != OMIT
  @provider = provider if provider != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "details": details,
    "providerDetails": provider_details,
    "metadata": ,
    "visibility": visibility,
    "type": type,
    "name": name,
    "provider": provider
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



28
29
30
# File 'lib/vapi_server_sdk/types/create_tool_template_dto.rb', line 28

def additional_properties
  @additional_properties
end

#detailsVapi::CreateToolTemplateDtoDetails (readonly)



14
15
16
# File 'lib/vapi_server_sdk/types/create_tool_template_dto.rb', line 14

def details
  @details
end

#metadataVapi::ToolTemplateMetadata (readonly)



18
19
20
# File 'lib/vapi_server_sdk/types/create_tool_template_dto.rb', line 18

def 
  @metadata
end

#nameString (readonly)

Returns The name of the template. This is just for your own reference.

Returns:

  • (String)

    The name of the template. This is just for your own reference.



24
25
26
# File 'lib/vapi_server_sdk/types/create_tool_template_dto.rb', line 24

def name
  @name
end

#providerVapi::CreateToolTemplateDtoProvider (readonly)



26
27
28
# File 'lib/vapi_server_sdk/types/create_tool_template_dto.rb', line 26

def provider
  @provider
end

#provider_detailsVapi::CreateToolTemplateDtoProviderDetails (readonly)



16
17
18
# File 'lib/vapi_server_sdk/types/create_tool_template_dto.rb', line 16

def provider_details
  @provider_details
end

#typeString (readonly)

Returns:

  • (String)


22
23
24
# File 'lib/vapi_server_sdk/types/create_tool_template_dto.rb', line 22

def type
  @type
end

#visibilityVapi::CreateToolTemplateDtoVisibility (readonly)



20
21
22
# File 'lib/vapi_server_sdk/types/create_tool_template_dto.rb', line 20

def visibility
  @visibility
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::CreateToolTemplateDto

Deserialize a JSON object to an instance of CreateToolTemplateDto

Parameters:

  • json_object (String)

Returns:



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/vapi_server_sdk/types/create_tool_template_dto.rb', line 71

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  if parsed_json["details"].nil?
    details = nil
  else
    details = parsed_json["details"].to_json
    details = Vapi::CreateToolTemplateDtoDetails.from_json(json_object: details)
  end
  if parsed_json["providerDetails"].nil?
    provider_details = nil
  else
    provider_details = parsed_json["providerDetails"].to_json
    provider_details = Vapi::CreateToolTemplateDtoProviderDetails.from_json(json_object: provider_details)
  end
  if parsed_json["metadata"].nil?
     = nil
  else
     = parsed_json["metadata"].to_json
     = Vapi::ToolTemplateMetadata.from_json(json_object: )
  end
  visibility = parsed_json["visibility"]
  type = parsed_json["type"]
  name = parsed_json["name"]
  provider = parsed_json["provider"]
  new(
    details: details,
    provider_details: provider_details,
    metadata: ,
    visibility: visibility,
    type: type,
    name: name,
    provider: provider,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


121
122
123
124
125
126
127
128
129
# File 'lib/vapi_server_sdk/types/create_tool_template_dto.rb', line 121

def self.validate_raw(obj:)
  obj.details.nil? || Vapi::CreateToolTemplateDtoDetails.validate_raw(obj: obj.details)
  obj.provider_details.nil? || Vapi::CreateToolTemplateDtoProviderDetails.validate_raw(obj: obj.provider_details)
  obj..nil? || Vapi::ToolTemplateMetadata.validate_raw(obj: obj.)
  obj.visibility&.is_a?(Vapi::CreateToolTemplateDtoVisibility) != false || raise("Passed value for field obj.visibility is not the expected type, validation failed.")
  obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.provider&.is_a?(Vapi::CreateToolTemplateDtoProvider) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of CreateToolTemplateDto to a JSON object

Returns:

  • (String)


111
112
113
# File 'lib/vapi_server_sdk/types/create_tool_template_dto.rb', line 111

def to_json(*_args)
  @_field_set&.to_json
end