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, 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)
  • 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



68
69
70
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
107
# File 'lib/vapi_server_sdk/types/file.rb', line 68

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, 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
  @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,
    "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



43
44
45
# File 'lib/vapi_server_sdk/types/file.rb', line 43

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.



39
40
41
# File 'lib/vapi_server_sdk/types/file.rb', line 39

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.



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

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})


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

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.



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

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

#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.



41
42
43
# File 'lib/vapi_server_sdk/types/file.rb', line 41

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:



113
114
115
116
117
118
119
120
121
122
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
# File 'lib/vapi_server_sdk/types/file.rb', line 113

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_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,
    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)


166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/vapi_server_sdk/types/file.rb', line 166

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.&.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)


156
157
158
# File 'lib/vapi_server_sdk/types/file.rb', line 156

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