Class: Vapi::File
- Inherits:
-
Object
- Object
- Vapi::File
- Defined in:
- lib/vapi_server_sdk/types/file.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #bucket ⇒ String readonly
- #bytes ⇒ Float readonly
-
#created_at ⇒ DateTime
readonly
This is the ISO 8601 date-time string of when the file was created.
-
#id ⇒ String
readonly
This is the unique identifier for the file.
- #key ⇒ String readonly
- #metadata ⇒ Hash{String => Object} readonly
- #mimetype ⇒ String readonly
-
#name ⇒ String
readonly
This is the name of the file.
- #object ⇒ String readonly
-
#org_id ⇒ String
readonly
This is the unique identifier for the org that this file belongs to.
- #original_name ⇒ String readonly
- #parsed_text_bytes ⇒ Float readonly
- #parsed_text_url ⇒ String readonly
- #path ⇒ String readonly
- #purpose ⇒ String readonly
- #status ⇒ Vapi::FileStatus readonly
-
#updated_at ⇒ DateTime
readonly
This is the ISO 8601 date-time string of when the file was last updated.
- #url ⇒ String readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::File
Deserialize a JSON object to an instance of File.
-
.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(id:, org_id:, created_at:, updated_at:, object: OMIT, status: OMIT, name: OMIT, original_name: OMIT, bytes: OMIT, purpose: OMIT, mimetype: OMIT, key: OMIT, path: OMIT, bucket: OMIT, url: OMIT, parsed_text_url: OMIT, parsed_text_bytes: OMIT, metadata: OMIT, additional_properties: nil) ⇒ Vapi::File constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of File to a JSON object.
Constructor Details
#initialize(id:, org_id:, created_at:, updated_at:, object: OMIT, status: OMIT, name: OMIT, original_name: OMIT, bytes: OMIT, purpose: OMIT, mimetype: OMIT, key: OMIT, path: OMIT, bucket: OMIT, url: OMIT, parsed_text_url: OMIT, parsed_text_bytes: OMIT, metadata: OMIT, additional_properties: nil) ⇒ Vapi::File
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 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/vapi_server_sdk/types/file.rb', line 74 def initialize(id:, org_id:, created_at:, updated_at:, object: OMIT, status: OMIT, name: OMIT, original_name: OMIT, bytes: OMIT, purpose: OMIT, mimetype: OMIT, key: OMIT, path: OMIT, bucket: OMIT, url: OMIT, parsed_text_url: OMIT, parsed_text_bytes: OMIT, metadata: OMIT, additional_properties: nil) @object = object if object != OMIT @status = status if status != OMIT @name = name if name != OMIT @original_name = original_name if original_name != OMIT @bytes = bytes if bytes != OMIT @purpose = purpose if purpose != OMIT @mimetype = mimetype if mimetype != OMIT @key = key if key != OMIT @path = path if path != OMIT @bucket = bucket if bucket != OMIT @url = url if url != OMIT @parsed_text_url = parsed_text_url if parsed_text_url != OMIT @parsed_text_bytes = parsed_text_bytes if parsed_text_bytes != OMIT @metadata = if != OMIT @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at @additional_properties = additional_properties @_field_set = { "object": object, "status": status, "name": name, "originalName": original_name, "bytes": bytes, "purpose": purpose, "mimetype": mimetype, "key": key, "path": path, "bucket": bucket, "url": url, "parsedTextUrl": parsed_text_url, "parsedTextBytes": parsed_text_bytes, "metadata": , "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.
47 48 49 |
# File 'lib/vapi_server_sdk/types/file.rb', line 47 def additional_properties @additional_properties end |
#bucket ⇒ String (readonly)
29 30 31 |
# File 'lib/vapi_server_sdk/types/file.rb', line 29 def bucket @bucket end |
#bytes ⇒ Float (readonly)
19 20 21 |
# File 'lib/vapi_server_sdk/types/file.rb', line 19 def bytes @bytes end |
#created_at ⇒ DateTime (readonly)
Returns This is the ISO 8601 date-time string of when the file was created.
43 44 45 |
# File 'lib/vapi_server_sdk/types/file.rb', line 43 def created_at @created_at end |
#id ⇒ String (readonly)
Returns This is the unique identifier for the file.
39 40 41 |
# File 'lib/vapi_server_sdk/types/file.rb', line 39 def id @id end |
#key ⇒ String (readonly)
25 26 27 |
# File 'lib/vapi_server_sdk/types/file.rb', line 25 def key @key end |
#metadata ⇒ Hash{String => Object} (readonly)
37 38 39 |
# File 'lib/vapi_server_sdk/types/file.rb', line 37 def @metadata end |
#mimetype ⇒ String (readonly)
23 24 25 |
# File 'lib/vapi_server_sdk/types/file.rb', line 23 def mimetype @mimetype end |
#name ⇒ String (readonly)
Returns This is the name of the file. This is just for your own reference.
15 16 17 |
# File 'lib/vapi_server_sdk/types/file.rb', line 15 def name @name end |
#object ⇒ String (readonly)
11 12 13 |
# File 'lib/vapi_server_sdk/types/file.rb', line 11 def object @object end |
#org_id ⇒ String (readonly)
Returns This is the unique identifier for the org that this file belongs to.
41 42 43 |
# File 'lib/vapi_server_sdk/types/file.rb', line 41 def org_id @org_id end |
#original_name ⇒ String (readonly)
17 18 19 |
# File 'lib/vapi_server_sdk/types/file.rb', line 17 def original_name @original_name end |
#parsed_text_bytes ⇒ Float (readonly)
35 36 37 |
# File 'lib/vapi_server_sdk/types/file.rb', line 35 def parsed_text_bytes @parsed_text_bytes end |
#parsed_text_url ⇒ String (readonly)
33 34 35 |
# File 'lib/vapi_server_sdk/types/file.rb', line 33 def parsed_text_url @parsed_text_url end |
#path ⇒ String (readonly)
27 28 29 |
# File 'lib/vapi_server_sdk/types/file.rb', line 27 def path @path end |
#purpose ⇒ String (readonly)
21 22 23 |
# File 'lib/vapi_server_sdk/types/file.rb', line 21 def purpose @purpose end |
#status ⇒ Vapi::FileStatus (readonly)
13 14 15 |
# File 'lib/vapi_server_sdk/types/file.rb', line 13 def status @status end |
#updated_at ⇒ DateTime (readonly)
Returns This is the ISO 8601 date-time string of when the file was last updated.
45 46 47 |
# File 'lib/vapi_server_sdk/types/file.rb', line 45 def updated_at @updated_at end |
#url ⇒ String (readonly)
31 32 33 |
# File 'lib/vapi_server_sdk/types/file.rb', line 31 def url @url end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::File
Deserialize a JSON object to an instance of File
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/vapi_server_sdk/types/file.rb', line 123 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) object = parsed_json["object"] status = parsed_json["status"] name = parsed_json["name"] original_name = parsed_json["originalName"] bytes = parsed_json["bytes"] purpose = parsed_json["purpose"] mimetype = parsed_json["mimetype"] key = parsed_json["key"] path = parsed_json["path"] bucket = parsed_json["bucket"] url = parsed_json["url"] parsed_text_url = parsed_json["parsedTextUrl"] parsed_text_bytes = parsed_json["parsedTextBytes"] = parsed_json["metadata"] 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( object: object, status: status, name: name, original_name: original_name, bytes: bytes, purpose: purpose, mimetype: mimetype, key: key, path: path, bucket: bucket, url: url, parsed_text_url: parsed_text_url, parsed_text_bytes: parsed_text_bytes, metadata: , 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.
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/vapi_server_sdk/types/file.rb', line 180 def self.validate_raw(obj:) obj.object&.is_a?(String) != false || raise("Passed value for field obj.object is not the expected type, validation failed.") obj.status&.is_a?(Vapi::FileStatus) != false || raise("Passed value for field obj.status 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.original_name&.is_a?(String) != false || raise("Passed value for field obj.original_name is not the expected type, validation failed.") obj.bytes&.is_a?(Float) != false || raise("Passed value for field obj.bytes is not the expected type, validation failed.") obj.purpose&.is_a?(String) != false || raise("Passed value for field obj.purpose is not the expected type, validation failed.") obj.mimetype&.is_a?(String) != false || raise("Passed value for field obj.mimetype is not the expected type, validation failed.") obj.key&.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.") obj.path&.is_a?(String) != false || raise("Passed value for field obj.path is not the expected type, validation failed.") obj.bucket&.is_a?(String) != false || raise("Passed value for field obj.bucket is not the expected type, validation failed.") obj.url&.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.") obj.parsed_text_url&.is_a?(String) != false || raise("Passed value for field obj.parsed_text_url is not the expected type, validation failed.") obj.parsed_text_bytes&.is_a?(Float) != false || raise("Passed value for field obj.parsed_text_bytes is not the expected type, validation failed.") obj.&.is_a?(Hash) != false || raise("Passed value for field obj.metadata 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 File to a JSON object
170 171 172 |
# File 'lib/vapi_server_sdk/types/file.rb', line 170 def to_json(*_args) @_field_set&.to_json end |