Class: Vapi::Template
- Inherits:
-
Object
- Object
- Vapi::Template
- Defined in:
- lib/vapi_server_sdk/types/template.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#created_at ⇒ DateTime
readonly
The ISO 8601 date-time string of when the template was created.
- #details ⇒ Vapi::TemplateDetails readonly
-
#id ⇒ String
readonly
The unique identifier for the template.
- #metadata ⇒ Vapi::ToolTemplateMetadata readonly
-
#name ⇒ String
readonly
The name of the template.
-
#org_id ⇒ String
readonly
The unique identifier for the organization that this template belongs to.
- #provider ⇒ Vapi::TemplateProvider readonly
- #provider_details ⇒ Vapi::TemplateProviderDetails readonly
- #type ⇒ String readonly
-
#updated_at ⇒ DateTime
readonly
The ISO 8601 date-time string of when the template was last updated.
- #visibility ⇒ Vapi::TemplateVisibility readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::Template
Deserialize a JSON object to an instance of Template.
-
.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.
Instance Method Summary collapse
- #initialize(type:, id:, org_id:, created_at:, updated_at:, details: OMIT, provider_details: OMIT, metadata: OMIT, visibility: OMIT, name: OMIT, provider: OMIT, additional_properties: nil) ⇒ Vapi::Template constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Template to a JSON object.
Constructor Details
#initialize(type:, id:, org_id:, created_at:, updated_at:, details: OMIT, provider_details: OMIT, metadata: OMIT, visibility: OMIT, name: OMIT, provider: OMIT, additional_properties: nil) ⇒ Vapi::Template
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/vapi_server_sdk/types/template.rb', line 57 def initialize(type:, id:, org_id:, created_at:, updated_at:, 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 @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at @additional_properties = additional_properties @_field_set = { "details": details, "providerDetails": provider_details, "metadata": , "visibility": visibility, "type": type, "name": name, "provider": provider, "id": id, "orgId": org_id, "createdAt": created_at, "updatedAt": updated_at }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
37 38 39 |
# File 'lib/vapi_server_sdk/types/template.rb', line 37 def additional_properties @additional_properties end |
#created_at ⇒ DateTime (readonly)
Returns The ISO 8601 date-time string of when the template was created.
33 34 35 |
# File 'lib/vapi_server_sdk/types/template.rb', line 33 def created_at @created_at end |
#details ⇒ Vapi::TemplateDetails (readonly)
15 16 17 |
# File 'lib/vapi_server_sdk/types/template.rb', line 15 def details @details end |
#id ⇒ String (readonly)
Returns The unique identifier for the template.
29 30 31 |
# File 'lib/vapi_server_sdk/types/template.rb', line 29 def id @id end |
#metadata ⇒ Vapi::ToolTemplateMetadata (readonly)
19 20 21 |
# File 'lib/vapi_server_sdk/types/template.rb', line 19 def @metadata end |
#name ⇒ String (readonly)
Returns The name of the template. This is just for your own reference.
25 26 27 |
# File 'lib/vapi_server_sdk/types/template.rb', line 25 def name @name end |
#org_id ⇒ String (readonly)
Returns The unique identifier for the organization that this template belongs to.
31 32 33 |
# File 'lib/vapi_server_sdk/types/template.rb', line 31 def org_id @org_id end |
#provider ⇒ Vapi::TemplateProvider (readonly)
27 28 29 |
# File 'lib/vapi_server_sdk/types/template.rb', line 27 def provider @provider end |
#provider_details ⇒ Vapi::TemplateProviderDetails (readonly)
17 18 19 |
# File 'lib/vapi_server_sdk/types/template.rb', line 17 def provider_details @provider_details end |
#type ⇒ String (readonly)
23 24 25 |
# File 'lib/vapi_server_sdk/types/template.rb', line 23 def type @type end |
#updated_at ⇒ DateTime (readonly)
Returns The ISO 8601 date-time string of when the template was last updated.
35 36 37 |
# File 'lib/vapi_server_sdk/types/template.rb', line 35 def updated_at @updated_at end |
#visibility ⇒ Vapi::TemplateVisibility (readonly)
21 22 23 |
# File 'lib/vapi_server_sdk/types/template.rb', line 21 def visibility @visibility end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::Template
Deserialize a JSON object to an instance of Template
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/vapi_server_sdk/types/template.rb', line 92 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::TemplateDetails.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::TemplateProviderDetails.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"] id = parsed_json["id"] org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) new( details: details, provider_details: provider_details, metadata: , visibility: visibility, type: type, name: name, provider: provider, id: id, org_id: org_id, created_at: created_at, updated_at: updated_at, 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.
150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/vapi_server_sdk/types/template.rb', line 150 def self.validate_raw(obj:) obj.details.nil? || Vapi::TemplateDetails.validate_raw(obj: obj.details) obj.provider_details.nil? || Vapi::TemplateProviderDetails.validate_raw(obj: obj.provider_details) obj..nil? || Vapi::ToolTemplateMetadata.validate_raw(obj: obj.) obj.visibility&.is_a?(Vapi::TemplateVisibility) != 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::TemplateProvider) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Template to a JSON object
140 141 142 |
# File 'lib/vapi_server_sdk/types/template.rb', line 140 def to_json(*_args) @_field_set&.to_json end |