Class: Vapi::File

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

Parameters:

  • object (String) (defaults to: OMIT)
  • status (Vapi::FileStatus) (defaults to: OMIT)
  • name (String) (defaults to: OMIT)

    This is the name of the file. This is just for your own reference.

  • original_name (String) (defaults to: OMIT)
  • bytes (Float) (defaults to: OMIT)
  • purpose (String) (defaults to: OMIT)
  • mimetype (String) (defaults to: OMIT)
  • key (String) (defaults to: OMIT)
  • path (String) (defaults to: OMIT)
  • bucket (String) (defaults to: OMIT)
  • url (String) (defaults to: OMIT)
  • parsed_text_url (String) (defaults to: OMIT)
  • parsed_text_bytes (Float) (defaults to: OMIT)
  • metadata (Hash{String => Object}) (defaults to: OMIT)
  • id (String)

    This is the unique identifier for the file.

  • org_id (String)

    This is the unique identifier for the org that this file belongs to.

  • created_at (DateTime)

    This is the ISO 8601 date-time string of when the file was created.

  • updated_at (DateTime)

    This is the ISO 8601 date-time string of when the file was last updated.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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

#bucketString (readonly)

Returns:

  • (String)


29
30
31
# File 'lib/vapi_server_sdk/types/file.rb', line 29

def bucket
  @bucket
end

#bytesFloat (readonly)

Returns:

  • (Float)


19
20
21
# File 'lib/vapi_server_sdk/types/file.rb', line 19

def bytes
  @bytes
end

#created_atDateTime (readonly)

Returns This is the ISO 8601 date-time string of when the file was created.

Returns:

  • (DateTime)

    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

#idString (readonly)

Returns This is the unique identifier for the file.

Returns:

  • (String)

    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

#keyString (readonly)

Returns:

  • (String)


25
26
27
# File 'lib/vapi_server_sdk/types/file.rb', line 25

def key
  @key
end

#metadataHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


37
38
39
# File 'lib/vapi_server_sdk/types/file.rb', line 37

def 
  @metadata
end

#mimetypeString (readonly)

Returns:

  • (String)


23
24
25
# File 'lib/vapi_server_sdk/types/file.rb', line 23

def mimetype
  @mimetype
end

#nameString (readonly)

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

Returns:

  • (String)

    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

#objectString (readonly)

Returns:

  • (String)


11
12
13
# File 'lib/vapi_server_sdk/types/file.rb', line 11

def object
  @object
end

#org_idString (readonly)

Returns This is the unique identifier for the org that this file belongs to.

Returns:

  • (String)

    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_nameString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/vapi_server_sdk/types/file.rb', line 17

def original_name
  @original_name
end

#parsed_text_bytesFloat (readonly)

Returns:

  • (Float)


35
36
37
# File 'lib/vapi_server_sdk/types/file.rb', line 35

def parsed_text_bytes
  @parsed_text_bytes
end

#parsed_text_urlString (readonly)

Returns:

  • (String)


33
34
35
# File 'lib/vapi_server_sdk/types/file.rb', line 33

def parsed_text_url
  @parsed_text_url
end

#pathString (readonly)

Returns:

  • (String)


27
28
29
# File 'lib/vapi_server_sdk/types/file.rb', line 27

def path
  @path
end

#purposeString (readonly)

Returns:

  • (String)


21
22
23
# File 'lib/vapi_server_sdk/types/file.rb', line 21

def purpose
  @purpose
end

#statusVapi::FileStatus (readonly)

Returns:



13
14
15
# File 'lib/vapi_server_sdk/types/file.rb', line 13

def status
  @status
end

#updated_atDateTime (readonly)

Returns This is the ISO 8601 date-time string of when the file was last updated.

Returns:

  • (DateTime)

    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

#urlString (readonly)

Returns:

  • (String)


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

Parameters:

  • json_object (String)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (String)


170
171
172
# File 'lib/vapi_server_sdk/types/file.rb', line 170

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