node-appwrite 12.0.0 → 12.1.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. package/.travis.yml +18 -8
  2. package/dist/client.d.mts +131 -0
  3. package/dist/client.d.ts +131 -0
  4. package/dist/client.js +302 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/client.mjs +295 -0
  7. package/dist/client.mjs.map +1 -0
  8. package/dist/enums/authentication-factor.d.mts +8 -0
  9. package/dist/enums/authentication-factor.d.ts +8 -0
  10. package/dist/enums/authentication-factor.js +13 -0
  11. package/dist/enums/authentication-factor.js.map +1 -0
  12. package/dist/enums/authentication-factor.mjs +11 -0
  13. package/dist/enums/authentication-factor.mjs.map +1 -0
  14. package/dist/enums/authenticator-type.d.mts +5 -0
  15. package/dist/enums/authenticator-type.d.ts +5 -0
  16. package/dist/enums/authenticator-type.js +10 -0
  17. package/dist/enums/authenticator-type.js.map +1 -0
  18. package/dist/enums/authenticator-type.mjs +8 -0
  19. package/dist/enums/authenticator-type.mjs.map +1 -0
  20. package/dist/enums/browser.d.mts +18 -0
  21. package/dist/enums/browser.d.ts +18 -0
  22. package/dist/enums/browser.js +23 -0
  23. package/dist/enums/browser.js.map +1 -0
  24. package/dist/enums/browser.mjs +21 -0
  25. package/dist/enums/browser.mjs.map +1 -0
  26. package/dist/enums/compression.d.mts +7 -0
  27. package/dist/enums/compression.d.ts +7 -0
  28. package/dist/enums/compression.js +12 -0
  29. package/dist/enums/compression.js.map +1 -0
  30. package/dist/enums/compression.mjs +10 -0
  31. package/dist/enums/compression.mjs.map +1 -0
  32. package/dist/enums/credit-card.d.mts +20 -0
  33. package/dist/enums/credit-card.d.ts +20 -0
  34. package/dist/enums/credit-card.js +25 -0
  35. package/dist/enums/credit-card.js.map +1 -0
  36. package/dist/enums/credit-card.mjs +23 -0
  37. package/dist/enums/credit-card.mjs.map +1 -0
  38. package/dist/enums/execution-method.d.mts +10 -0
  39. package/dist/enums/execution-method.d.ts +10 -0
  40. package/dist/enums/execution-method.js +15 -0
  41. package/dist/enums/execution-method.js.map +1 -0
  42. package/dist/enums/execution-method.mjs +13 -0
  43. package/dist/enums/execution-method.mjs.map +1 -0
  44. package/dist/enums/flag.d.mts +198 -0
  45. package/dist/enums/flag.d.ts +198 -0
  46. package/dist/enums/flag.js +203 -0
  47. package/dist/enums/flag.js.map +1 -0
  48. package/dist/enums/flag.mjs +201 -0
  49. package/dist/enums/flag.mjs.map +1 -0
  50. package/dist/enums/image-format.d.mts +9 -0
  51. package/dist/enums/image-format.d.ts +9 -0
  52. package/dist/enums/image-format.js +14 -0
  53. package/dist/enums/image-format.js.map +1 -0
  54. package/dist/enums/image-format.mjs +12 -0
  55. package/dist/enums/image-format.mjs.map +1 -0
  56. package/dist/enums/image-gravity.d.mts +13 -0
  57. package/dist/enums/image-gravity.d.ts +13 -0
  58. package/dist/enums/image-gravity.js +18 -0
  59. package/dist/enums/image-gravity.js.map +1 -0
  60. package/dist/enums/image-gravity.mjs +16 -0
  61. package/dist/enums/image-gravity.mjs.map +1 -0
  62. package/dist/enums/index-type.d.mts +7 -0
  63. package/dist/enums/index-type.d.ts +7 -0
  64. package/dist/enums/index-type.js +12 -0
  65. package/dist/enums/index-type.js.map +1 -0
  66. package/dist/enums/index-type.mjs +10 -0
  67. package/dist/enums/index-type.mjs.map +1 -0
  68. package/dist/enums/messaging-provider-type.d.mts +7 -0
  69. package/dist/enums/messaging-provider-type.d.ts +7 -0
  70. package/dist/enums/messaging-provider-type.js +12 -0
  71. package/dist/enums/messaging-provider-type.js.map +1 -0
  72. package/dist/enums/messaging-provider-type.mjs +10 -0
  73. package/dist/enums/messaging-provider-type.mjs.map +1 -0
  74. package/dist/enums/name.d.mts +17 -0
  75. package/dist/enums/name.d.ts +17 -0
  76. package/dist/enums/name.js +22 -0
  77. package/dist/enums/name.js.map +1 -0
  78. package/dist/enums/name.mjs +20 -0
  79. package/dist/enums/name.mjs.map +1 -0
  80. package/dist/enums/o-auth-provider.d.mts +43 -0
  81. package/dist/enums/o-auth-provider.d.ts +43 -0
  82. package/dist/enums/o-auth-provider.js +48 -0
  83. package/dist/enums/o-auth-provider.js.map +1 -0
  84. package/dist/enums/o-auth-provider.mjs +46 -0
  85. package/dist/enums/o-auth-provider.mjs.map +1 -0
  86. package/dist/enums/password-hash.d.mts +15 -0
  87. package/dist/enums/password-hash.d.ts +15 -0
  88. package/dist/enums/password-hash.js +20 -0
  89. package/dist/enums/password-hash.js.map +1 -0
  90. package/dist/enums/password-hash.mjs +18 -0
  91. package/dist/enums/password-hash.mjs.map +1 -0
  92. package/dist/enums/relation-mutate.d.mts +7 -0
  93. package/dist/enums/relation-mutate.d.ts +7 -0
  94. package/dist/enums/relation-mutate.js +12 -0
  95. package/dist/enums/relation-mutate.js.map +1 -0
  96. package/dist/enums/relation-mutate.mjs +10 -0
  97. package/dist/enums/relation-mutate.mjs.map +1 -0
  98. package/dist/enums/relationship-type.d.mts +8 -0
  99. package/dist/enums/relationship-type.d.ts +8 -0
  100. package/dist/enums/relationship-type.js +13 -0
  101. package/dist/enums/relationship-type.js.map +1 -0
  102. package/dist/enums/relationship-type.mjs +11 -0
  103. package/dist/enums/relationship-type.mjs.map +1 -0
  104. package/dist/enums/runtime.d.mts +48 -0
  105. package/dist/enums/runtime.d.ts +48 -0
  106. package/dist/enums/runtime.js +53 -0
  107. package/dist/enums/runtime.js.map +1 -0
  108. package/dist/enums/runtime.mjs +51 -0
  109. package/dist/enums/runtime.mjs.map +1 -0
  110. package/dist/enums/smtp-encryption.d.mts +7 -0
  111. package/dist/enums/smtp-encryption.d.ts +7 -0
  112. package/dist/enums/smtp-encryption.js +12 -0
  113. package/dist/enums/smtp-encryption.js.map +1 -0
  114. package/dist/enums/smtp-encryption.mjs +10 -0
  115. package/dist/enums/smtp-encryption.mjs.map +1 -0
  116. package/dist/id.d.mts +7 -0
  117. package/dist/id.d.ts +7 -0
  118. package/dist/id.js +29 -0
  119. package/dist/id.js.map +1 -0
  120. package/dist/id.mjs +27 -0
  121. package/dist/id.mjs.map +1 -0
  122. package/dist/index.d.mts +35 -0
  123. package/dist/index.d.ts +35 -0
  124. package/dist/index.js +180 -0
  125. package/dist/index.js.map +1 -0
  126. package/dist/index.mjs +35 -0
  127. package/dist/index.mjs.map +1 -0
  128. package/dist/inputFile.d.mts +9 -0
  129. package/dist/inputFile.d.ts +9 -0
  130. package/dist/inputFile.js +23 -0
  131. package/dist/inputFile.js.map +1 -0
  132. package/dist/inputFile.mjs +21 -0
  133. package/dist/inputFile.mjs.map +1 -0
  134. package/dist/models.d.mts +2406 -0
  135. package/dist/models.d.ts +2406 -0
  136. package/dist/models.js +4 -0
  137. package/dist/models.js.map +1 -0
  138. package/dist/models.mjs +3 -0
  139. package/dist/models.mjs.map +1 -0
  140. package/dist/permission.d.mts +9 -0
  141. package/dist/permission.d.ts +9 -0
  142. package/dist/permission.js +23 -0
  143. package/dist/permission.js.map +1 -0
  144. package/dist/permission.mjs +21 -0
  145. package/dist/permission.mjs.map +1 -0
  146. package/dist/query.d.mts +35 -0
  147. package/dist/query.d.ts +35 -0
  148. package/dist/query.js +49 -0
  149. package/dist/query.js.map +1 -0
  150. package/dist/query.mjs +47 -0
  151. package/dist/query.mjs.map +1 -0
  152. package/dist/role.d.mts +72 -0
  153. package/dist/role.d.ts +72 -0
  154. package/dist/role.js +96 -0
  155. package/dist/role.js.map +1 -0
  156. package/dist/role.mjs +94 -0
  157. package/dist/role.mjs.map +1 -0
  158. package/dist/services/account.d.mts +478 -0
  159. package/dist/services/account.d.ts +478 -0
  160. package/dist/services/account.js +1331 -0
  161. package/dist/services/account.js.map +1 -0
  162. package/dist/services/account.mjs +1329 -0
  163. package/dist/services/account.mjs.map +1 -0
  164. package/dist/services/avatars.d.mts +118 -0
  165. package/dist/services/avatars.d.ts +118 -0
  166. package/dist/services/avatars.js +297 -0
  167. package/dist/services/avatars.js.map +1 -0
  168. package/dist/services/avatars.mjs +295 -0
  169. package/dist/services/avatars.mjs.map +1 -0
  170. package/dist/services/databases.d.mts +606 -0
  171. package/dist/services/databases.d.ts +606 -0
  172. package/dist/services/databases.js +1908 -0
  173. package/dist/services/databases.js.map +1 -0
  174. package/dist/services/databases.mjs +1906 -0
  175. package/dist/services/databases.mjs.map +1 -0
  176. package/dist/services/functions.d.mts +287 -0
  177. package/dist/services/functions.d.ts +287 -0
  178. package/dist/services/functions.js +837 -0
  179. package/dist/services/functions.js.map +1 -0
  180. package/dist/services/functions.mjs +835 -0
  181. package/dist/services/functions.mjs.map +1 -0
  182. package/dist/services/graphql.d.mts +30 -0
  183. package/dist/services/graphql.d.ts +30 -0
  184. package/dist/services/graphql.js +73 -0
  185. package/dist/services/graphql.js.map +1 -0
  186. package/dist/services/graphql.mjs +71 -0
  187. package/dist/services/graphql.mjs.map +1 -0
  188. package/dist/services/health.d.mts +235 -0
  189. package/dist/services/health.d.ts +235 -0
  190. package/dist/services/health.js +584 -0
  191. package/dist/services/health.js.map +1 -0
  192. package/dist/services/health.mjs +582 -0
  193. package/dist/services/health.mjs.map +1 -0
  194. package/dist/services/locale.d.mts +84 -0
  195. package/dist/services/locale.d.ts +84 -0
  196. package/dist/services/locale.js +189 -0
  197. package/dist/services/locale.js.map +1 -0
  198. package/dist/services/locale.mjs +187 -0
  199. package/dist/services/locale.mjs.map +1 -0
  200. package/dist/services/messaging.d.mts +688 -0
  201. package/dist/services/messaging.d.ts +688 -0
  202. package/dist/services/messaging.js +2152 -0
  203. package/dist/services/messaging.js.map +1 -0
  204. package/dist/services/messaging.mjs +2150 -0
  205. package/dist/services/messaging.mjs.map +1 -0
  206. package/dist/services/storage.d.mts +193 -0
  207. package/dist/services/storage.d.ts +193 -0
  208. package/dist/services/storage.js +550 -0
  209. package/dist/services/storage.js.map +1 -0
  210. package/dist/services/storage.mjs +548 -0
  211. package/dist/services/storage.mjs.map +1 -0
  212. package/dist/services/teams.d.mts +171 -0
  213. package/dist/services/teams.d.ts +171 -0
  214. package/dist/services/teams.js +466 -0
  215. package/dist/services/teams.js.map +1 -0
  216. package/dist/services/teams.mjs +464 -0
  217. package/dist/services/teams.mjs.map +1 -0
  218. package/dist/services/users.d.mts +490 -0
  219. package/dist/services/users.d.ts +490 -0
  220. package/dist/services/users.js +1464 -0
  221. package/dist/services/users.js.map +1 -0
  222. package/dist/services/users.mjs +1462 -0
  223. package/dist/services/users.mjs.map +1 -0
  224. package/docs/examples/functions/create-deployment.md +1 -1
  225. package/docs/examples/storage/create-file.md +1 -1
  226. package/package.json +35 -5
  227. package/src/client.ts +366 -0
  228. package/src/enums/authentication-factor.ts +6 -0
  229. package/src/enums/authenticator-type.ts +3 -0
  230. package/src/enums/browser.ts +16 -0
  231. package/src/enums/compression.ts +5 -0
  232. package/src/enums/credit-card.ts +18 -0
  233. package/src/enums/execution-method.ts +8 -0
  234. package/src/enums/flag.ts +196 -0
  235. package/src/enums/image-format.ts +7 -0
  236. package/src/enums/image-gravity.ts +11 -0
  237. package/src/enums/index-type.ts +5 -0
  238. package/src/enums/messaging-provider-type.ts +5 -0
  239. package/src/enums/name.ts +15 -0
  240. package/src/enums/o-auth-provider.ts +41 -0
  241. package/src/enums/password-hash.ts +13 -0
  242. package/src/enums/relation-mutate.ts +5 -0
  243. package/src/enums/relationship-type.ts +6 -0
  244. package/src/enums/runtime.ts +46 -0
  245. package/src/enums/smtp-encryption.ts +5 -0
  246. package/src/id.ts +28 -0
  247. package/src/index.ts +35 -0
  248. package/src/inputFile.ts +23 -0
  249. package/src/models.ts +2404 -0
  250. package/src/permission.ts +22 -0
  251. package/src/query.ts +101 -0
  252. package/{lib/role.js → src/role.ts} +23 -25
  253. package/src/services/account.ts +1418 -0
  254. package/src/services/avatars.ts +312 -0
  255. package/{lib/services/databases.js → src/services/databases.ts} +644 -638
  256. package/{lib/services/functions.js → src/services/functions.ts} +317 -369
  257. package/{lib/services/graphql.js → src/services/graphql.ts} +35 -34
  258. package/src/services/health.ts +629 -0
  259. package/src/services/locale.ts +205 -0
  260. package/{lib/services/messaging.js → src/services/messaging.ts} +658 -633
  261. package/{lib/services/storage.js → src/services/storage.ts} +211 -298
  262. package/{lib/services/teams.js → src/services/teams.ts} +211 -200
  263. package/{lib/services/users.js → src/services/users.ts} +603 -519
  264. package/tsconfig.json +18 -0
  265. package/tsup.config.js +19 -0
  266. package/index.d.ts +0 -6656
  267. package/index.js +0 -75
  268. package/lib/client.js +0 -245
  269. package/lib/enums/authentication-factor.js +0 -8
  270. package/lib/enums/authenticator-type.js +0 -5
  271. package/lib/enums/browser.js +0 -18
  272. package/lib/enums/compression.js +0 -7
  273. package/lib/enums/credit-card.js +0 -20
  274. package/lib/enums/execution-method.js +0 -10
  275. package/lib/enums/flag.js +0 -198
  276. package/lib/enums/image-format.js +0 -9
  277. package/lib/enums/image-gravity.js +0 -13
  278. package/lib/enums/index-type.js +0 -7
  279. package/lib/enums/messaging-provider-type.js +0 -7
  280. package/lib/enums/name.js +0 -17
  281. package/lib/enums/o-auth-provider.js +0 -43
  282. package/lib/enums/password-hash.js +0 -15
  283. package/lib/enums/relation-mutate.js +0 -7
  284. package/lib/enums/relationship-type.js +0 -8
  285. package/lib/enums/runtime.js +0 -48
  286. package/lib/enums/smtp-encryption.js +0 -7
  287. package/lib/exception.js +0 -10
  288. package/lib/id.js +0 -12
  289. package/lib/inputFile.js +0 -117
  290. package/lib/permission.js +0 -24
  291. package/lib/query.js +0 -90
  292. package/lib/service.js +0 -10
  293. package/lib/services/account.js +0 -1365
  294. package/lib/services/avatars.js +0 -325
  295. package/lib/services/health.js +0 -513
  296. package/lib/services/locale.js +0 -169
@@ -1,49 +1,48 @@
1
- const Service = require('../service.js');
2
- const AppwriteException = require('../exception.js');
3
- const InputFile = require('../inputFile.js');
4
- const client = require('../client.js');
5
- const Stream = require('stream');
6
- const { promisify } = require('util');
7
- const fs = require('fs');
8
- const { File } = require('undici');
9
- const Query = require('../query.js');
1
+ import { AppwriteException, Client, type Payload, UploadProgress } from '../client';
2
+ import type { Models } from '../models';
3
+ import { Compression } from '../enums/compression';
4
+ import { ImageGravity } from '../enums/image-gravity';
5
+ import { ImageFormat } from '../enums/image-format';
10
6
 
11
- class Storage extends Service {
12
-
13
- constructor(client)
14
- {
15
- super(client);
16
- }
7
+ export class Storage {
8
+ client: Client;
17
9
 
10
+ constructor(client: Client) {
11
+ this.client = client;
12
+ }
18
13
 
19
14
  /**
20
15
  * List buckets
21
16
  *
22
- * Get a list of all the storage buckets. You can use the query params to
23
- * filter your results.
17
+ * Get a list of all the storage buckets. You can use the query params to filter your results.
24
18
  *
25
19
  * @param {string[]} queries
26
20
  * @param {string} search
27
21
  * @throws {AppwriteException}
28
- * @returns {Promise}
22
+ * @returns {Promise<Models.BucketList>}
29
23
  */
30
- async listBuckets(queries, search) {
24
+ async listBuckets(queries?: string[], search?: string): Promise<Models.BucketList> {
31
25
  const apiPath = '/storage/buckets';
32
- let payload = {};
33
-
26
+ const payload: Payload = {};
34
27
  if (typeof queries !== 'undefined') {
35
28
  payload['queries'] = queries;
36
29
  }
37
-
38
30
  if (typeof search !== 'undefined') {
39
31
  payload['search'] = search;
40
32
  }
33
+ const uri = new URL(this.client.config.endpoint + apiPath);
41
34
 
42
- return await this.client.call('get', apiPath, {
35
+ const apiHeaders: { [header: string]: string } = {
43
36
  'content-type': 'application/json',
44
- }, payload);
45
- }
37
+ }
46
38
 
39
+ return await this.client.call(
40
+ 'get',
41
+ uri,
42
+ apiHeaders,
43
+ payload,
44
+ );
45
+ }
47
46
  /**
48
47
  * Create bucket
49
48
  *
@@ -60,88 +59,88 @@ class Storage extends Service {
60
59
  * @param {boolean} encryption
61
60
  * @param {boolean} antivirus
62
61
  * @throws {AppwriteException}
63
- * @returns {Promise}
62
+ * @returns {Promise<Models.Bucket>}
64
63
  */
65
- async createBucket(bucketId, name, permissions, fileSecurity, enabled, maximumFileSize, allowedFileExtensions, compression, encryption, antivirus) {
66
- const apiPath = '/storage/buckets';
67
- let payload = {};
64
+ async createBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean): Promise<Models.Bucket> {
68
65
  if (typeof bucketId === 'undefined') {
69
66
  throw new AppwriteException('Missing required parameter: "bucketId"');
70
67
  }
71
-
72
68
  if (typeof name === 'undefined') {
73
69
  throw new AppwriteException('Missing required parameter: "name"');
74
70
  }
75
-
76
-
71
+ const apiPath = '/storage/buckets';
72
+ const payload: Payload = {};
77
73
  if (typeof bucketId !== 'undefined') {
78
74
  payload['bucketId'] = bucketId;
79
75
  }
80
-
81
76
  if (typeof name !== 'undefined') {
82
77
  payload['name'] = name;
83
78
  }
84
-
85
79
  if (typeof permissions !== 'undefined') {
86
80
  payload['permissions'] = permissions;
87
81
  }
88
-
89
82
  if (typeof fileSecurity !== 'undefined') {
90
83
  payload['fileSecurity'] = fileSecurity;
91
84
  }
92
-
93
85
  if (typeof enabled !== 'undefined') {
94
86
  payload['enabled'] = enabled;
95
87
  }
96
-
97
88
  if (typeof maximumFileSize !== 'undefined') {
98
89
  payload['maximumFileSize'] = maximumFileSize;
99
90
  }
100
-
101
91
  if (typeof allowedFileExtensions !== 'undefined') {
102
92
  payload['allowedFileExtensions'] = allowedFileExtensions;
103
93
  }
104
-
105
94
  if (typeof compression !== 'undefined') {
106
95
  payload['compression'] = compression;
107
96
  }
108
-
109
97
  if (typeof encryption !== 'undefined') {
110
98
  payload['encryption'] = encryption;
111
99
  }
112
-
113
100
  if (typeof antivirus !== 'undefined') {
114
101
  payload['antivirus'] = antivirus;
115
102
  }
103
+ const uri = new URL(this.client.config.endpoint + apiPath);
116
104
 
117
- return await this.client.call('post', apiPath, {
105
+ const apiHeaders: { [header: string]: string } = {
118
106
  'content-type': 'application/json',
119
- }, payload);
120
- }
107
+ }
121
108
 
109
+ return await this.client.call(
110
+ 'post',
111
+ uri,
112
+ apiHeaders,
113
+ payload,
114
+ );
115
+ }
122
116
  /**
123
117
  * Get bucket
124
118
  *
125
- * Get a storage bucket by its unique ID. This endpoint response returns a
126
- * JSON object with the storage bucket metadata.
119
+ * Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.
127
120
  *
128
121
  * @param {string} bucketId
129
122
  * @throws {AppwriteException}
130
- * @returns {Promise}
123
+ * @returns {Promise<Models.Bucket>}
131
124
  */
132
- async getBucket(bucketId) {
133
- const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
134
- let payload = {};
125
+ async getBucket(bucketId: string): Promise<Models.Bucket> {
135
126
  if (typeof bucketId === 'undefined') {
136
127
  throw new AppwriteException('Missing required parameter: "bucketId"');
137
128
  }
129
+ const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
130
+ const payload: Payload = {};
131
+ const uri = new URL(this.client.config.endpoint + apiPath);
138
132
 
139
-
140
- return await this.client.call('get', apiPath, {
133
+ const apiHeaders: { [header: string]: string } = {
141
134
  'content-type': 'application/json',
142
- }, payload);
143
- }
135
+ }
144
136
 
137
+ return await this.client.call(
138
+ 'get',
139
+ uri,
140
+ apiHeaders,
141
+ payload,
142
+ );
143
+ }
145
144
  /**
146
145
  * Update bucket
147
146
  *
@@ -158,61 +157,57 @@ class Storage extends Service {
158
157
  * @param {boolean} encryption
159
158
  * @param {boolean} antivirus
160
159
  * @throws {AppwriteException}
161
- * @returns {Promise}
160
+ * @returns {Promise<Models.Bucket>}
162
161
  */
163
- async updateBucket(bucketId, name, permissions, fileSecurity, enabled, maximumFileSize, allowedFileExtensions, compression, encryption, antivirus) {
164
- const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
165
- let payload = {};
162
+ async updateBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean): Promise<Models.Bucket> {
166
163
  if (typeof bucketId === 'undefined') {
167
164
  throw new AppwriteException('Missing required parameter: "bucketId"');
168
165
  }
169
-
170
166
  if (typeof name === 'undefined') {
171
167
  throw new AppwriteException('Missing required parameter: "name"');
172
168
  }
173
-
174
-
169
+ const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
170
+ const payload: Payload = {};
175
171
  if (typeof name !== 'undefined') {
176
172
  payload['name'] = name;
177
173
  }
178
-
179
174
  if (typeof permissions !== 'undefined') {
180
175
  payload['permissions'] = permissions;
181
176
  }
182
-
183
177
  if (typeof fileSecurity !== 'undefined') {
184
178
  payload['fileSecurity'] = fileSecurity;
185
179
  }
186
-
187
180
  if (typeof enabled !== 'undefined') {
188
181
  payload['enabled'] = enabled;
189
182
  }
190
-
191
183
  if (typeof maximumFileSize !== 'undefined') {
192
184
  payload['maximumFileSize'] = maximumFileSize;
193
185
  }
194
-
195
186
  if (typeof allowedFileExtensions !== 'undefined') {
196
187
  payload['allowedFileExtensions'] = allowedFileExtensions;
197
188
  }
198
-
199
189
  if (typeof compression !== 'undefined') {
200
190
  payload['compression'] = compression;
201
191
  }
202
-
203
192
  if (typeof encryption !== 'undefined') {
204
193
  payload['encryption'] = encryption;
205
194
  }
206
-
207
195
  if (typeof antivirus !== 'undefined') {
208
196
  payload['antivirus'] = antivirus;
209
197
  }
198
+ const uri = new URL(this.client.config.endpoint + apiPath);
210
199
 
211
- return await this.client.call('put', apiPath, {
200
+ const apiHeaders: { [header: string]: string } = {
212
201
  'content-type': 'application/json',
213
- }, payload);
214
- }
202
+ }
215
203
 
204
+ return await this.client.call(
205
+ 'put',
206
+ uri,
207
+ apiHeaders,
208
+ payload,
209
+ );
210
+ }
216
211
  /**
217
212
  * Delete bucket
218
213
  *
@@ -220,338 +215,258 @@ class Storage extends Service {
220
215
  *
221
216
  * @param {string} bucketId
222
217
  * @throws {AppwriteException}
223
- * @returns {Promise}
218
+ * @returns {Promise<{}>}
224
219
  */
225
- async deleteBucket(bucketId) {
226
- const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
227
- let payload = {};
220
+ async deleteBucket(bucketId: string): Promise<{}> {
228
221
  if (typeof bucketId === 'undefined') {
229
222
  throw new AppwriteException('Missing required parameter: "bucketId"');
230
223
  }
224
+ const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
225
+ const payload: Payload = {};
226
+ const uri = new URL(this.client.config.endpoint + apiPath);
231
227
 
232
-
233
- return await this.client.call('delete', apiPath, {
228
+ const apiHeaders: { [header: string]: string } = {
234
229
  'content-type': 'application/json',
235
- }, payload);
236
- }
230
+ }
237
231
 
232
+ return await this.client.call(
233
+ 'delete',
234
+ uri,
235
+ apiHeaders,
236
+ payload,
237
+ );
238
+ }
238
239
  /**
239
240
  * List files
240
241
  *
241
- * Get a list of all the user files. You can use the query params to filter
242
- * your results.
242
+ * Get a list of all the user files. You can use the query params to filter your results.
243
243
  *
244
244
  * @param {string} bucketId
245
245
  * @param {string[]} queries
246
246
  * @param {string} search
247
247
  * @throws {AppwriteException}
248
- * @returns {Promise}
248
+ * @returns {Promise<Models.FileList>}
249
249
  */
250
- async listFiles(bucketId, queries, search) {
251
- const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
252
- let payload = {};
250
+ async listFiles(bucketId: string, queries?: string[], search?: string): Promise<Models.FileList> {
253
251
  if (typeof bucketId === 'undefined') {
254
252
  throw new AppwriteException('Missing required parameter: "bucketId"');
255
253
  }
256
-
257
-
254
+ const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
255
+ const payload: Payload = {};
258
256
  if (typeof queries !== 'undefined') {
259
257
  payload['queries'] = queries;
260
258
  }
261
-
262
259
  if (typeof search !== 'undefined') {
263
260
  payload['search'] = search;
264
261
  }
262
+ const uri = new URL(this.client.config.endpoint + apiPath);
265
263
 
266
- return await this.client.call('get', apiPath, {
264
+ const apiHeaders: { [header: string]: string } = {
267
265
  'content-type': 'application/json',
268
- }, payload);
269
- }
266
+ }
270
267
 
268
+ return await this.client.call(
269
+ 'get',
270
+ uri,
271
+ apiHeaders,
272
+ payload,
273
+ );
274
+ }
271
275
  /**
272
276
  * Create file
273
277
  *
274
- * Create a new file. Before using this route, you should create a new bucket
275
- * resource using either a [server
276
- * integration](https://appwrite.io/docs/server/storage#storageCreateBucket)
277
- * API or directly from your Appwrite console.
278
- *
279
- * Larger files should be uploaded using multiple requests with the
280
- * [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range)
281
- * header to send a partial request with a maximum supported chunk of `5MB`.
282
- * The `content-range` header values should always be in bytes.
283
- *
284
- * When the first request is sent, the server will return the **File** object,
285
- * and the subsequent part request must include the file's **id** in
286
- * `x-appwrite-id` header to allow the server to know that the partial upload
287
- * is for the existing file and not for a new one.
288
- *
289
- * If you're creating a new file using one of the Appwrite SDKs, all the
290
- * chunking logic will be managed by the SDK internally.
291
- *
278
+ * Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console.
279
+
280
+ Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.
281
+
282
+ When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file&#039;s **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.
283
+
284
+ If you&#039;re creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally.
285
+
292
286
  *
293
287
  * @param {string} bucketId
294
288
  * @param {string} fileId
295
- * @param {InputFile} file
289
+ * @param {File} file
296
290
  * @param {string[]} permissions
297
- * @param {CallableFunction} onProgress
298
291
  * @throws {AppwriteException}
299
- * @returns {Promise}
292
+ * @returns {Promise<Models.File>}
300
293
  */
301
- async createFile(bucketId, fileId, file, permissions, onProgress = () => {}) {
302
- const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
303
- let payload = {};
294
+ async createFile(bucketId: string, fileId: string, file: File, permissions?: string[], onProgress = (progress: UploadProgress) => {}): Promise<Models.File> {
304
295
  if (typeof bucketId === 'undefined') {
305
296
  throw new AppwriteException('Missing required parameter: "bucketId"');
306
297
  }
307
-
308
298
  if (typeof fileId === 'undefined') {
309
299
  throw new AppwriteException('Missing required parameter: "fileId"');
310
300
  }
311
-
312
301
  if (typeof file === 'undefined') {
313
302
  throw new AppwriteException('Missing required parameter: "file"');
314
303
  }
315
-
316
-
304
+ const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
305
+ const payload: Payload = {};
317
306
  if (typeof fileId !== 'undefined') {
318
307
  payload['fileId'] = fileId;
319
308
  }
320
-
321
309
  if (typeof file !== 'undefined') {
322
310
  payload['file'] = file;
323
311
  }
324
-
325
312
  if (typeof permissions !== 'undefined') {
326
313
  payload['permissions'] = permissions;
327
314
  }
315
+ const uri = new URL(this.client.config.endpoint + apiPath);
328
316
 
329
-
330
- const size = file.size;
331
-
332
- const apiHeaders = {
317
+ const apiHeaders: { [header: string]: string } = {
333
318
  'content-type': 'multipart/form-data',
334
- };
335
-
336
- let id = undefined;
337
- let response = undefined;
338
-
339
- let chunksUploaded = 0;
340
-
341
- if(fileId != 'unique()') {
342
- try {
343
- response = await this.client.call('get', apiPath + '/' + fileId, apiHeaders);
344
- chunksUploaded = response.chunksUploaded;
345
- } catch(e) {
346
- }
347
319
  }
348
320
 
349
- let currentChunk = 1;
350
- let currentPosition = 0;
351
- let uploadableChunk = new Uint8Array(client.CHUNK_SIZE);
352
-
353
-
354
- const uploadChunk = async (lastUpload = false) => {
355
- if(currentChunk <= chunksUploaded) {
356
- return;
357
- }
358
-
359
- const start = ((currentChunk - 1) * client.CHUNK_SIZE);
360
- let end = start + currentPosition - 1;
361
-
362
- if(!lastUpload || currentChunk !== 1) {
363
- apiHeaders['content-range'] = 'bytes ' + start + '-' + end + '/' + size;
364
- }
365
-
366
- let uploadableChunkTrimmed;
367
-
368
- if(currentPosition + 1 >= client.CHUNK_SIZE) {
369
- uploadableChunkTrimmed = uploadableChunk;
370
- } else {
371
- uploadableChunkTrimmed = new Uint8Array(currentPosition);
372
- for(let i = 0; i <= currentPosition; i++) {
373
- uploadableChunkTrimmed[i] = uploadableChunk[i];
374
- }
375
- }
376
-
377
- if (id) {
378
- apiHeaders['x-appwrite-id'] = id;
379
- }
380
-
381
- payload['file'] = { type: 'file', file: new File([uploadableChunkTrimmed], file.filename), filename: file.filename };
382
-
383
- response = await this.client.call('post', apiPath, apiHeaders, payload);
384
-
385
- if (!id) {
386
- id = response['$id'];
387
- }
388
-
389
- if (onProgress !== null) {
390
- onProgress({
391
- $id: response['$id'],
392
- progress: Math.min((currentChunk) * client.CHUNK_SIZE, size) / size * 100,
393
- sizeUploaded: end+1,
394
- chunksTotal: response['chunksTotal'],
395
- chunksUploaded: response['chunksUploaded']
396
- });
397
- }
398
-
399
- uploadableChunk = new Uint8Array(client.CHUNK_SIZE);
400
- currentChunk++;
401
- currentPosition = 0;
402
- }
403
-
404
- for await (const chunk of file.stream) {
405
- for(const b of chunk) {
406
- uploadableChunk[currentPosition] = b;
407
-
408
- currentPosition++;
409
- if(currentPosition >= client.CHUNK_SIZE) {
410
- await uploadChunk();
411
- currentPosition = 0;
412
- }
413
- }
414
- }
415
-
416
- if (currentPosition > 0) { // Check if there's any remaining data for the last chunk
417
- await uploadChunk(true);
418
- }
419
-
420
- return response;
421
-
321
+ return await this.client.chunkedUpload(
322
+ 'post',
323
+ uri,
324
+ apiHeaders,
325
+ payload,
326
+ onProgress
327
+ );
422
328
  }
423
-
424
329
  /**
425
330
  * Get file
426
331
  *
427
- * Get a file by its unique ID. This endpoint response returns a JSON object
428
- * with the file metadata.
332
+ * Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
429
333
  *
430
334
  * @param {string} bucketId
431
335
  * @param {string} fileId
432
336
  * @throws {AppwriteException}
433
- * @returns {Promise}
337
+ * @returns {Promise<Models.File>}
434
338
  */
435
- async getFile(bucketId, fileId) {
436
- const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
437
- let payload = {};
339
+ async getFile(bucketId: string, fileId: string): Promise<Models.File> {
438
340
  if (typeof bucketId === 'undefined') {
439
341
  throw new AppwriteException('Missing required parameter: "bucketId"');
440
342
  }
441
-
442
343
  if (typeof fileId === 'undefined') {
443
344
  throw new AppwriteException('Missing required parameter: "fileId"');
444
345
  }
346
+ const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
347
+ const payload: Payload = {};
348
+ const uri = new URL(this.client.config.endpoint + apiPath);
445
349
 
446
-
447
- return await this.client.call('get', apiPath, {
350
+ const apiHeaders: { [header: string]: string } = {
448
351
  'content-type': 'application/json',
449
- }, payload);
450
- }
352
+ }
451
353
 
354
+ return await this.client.call(
355
+ 'get',
356
+ uri,
357
+ apiHeaders,
358
+ payload,
359
+ );
360
+ }
452
361
  /**
453
362
  * Update file
454
363
  *
455
- * Update a file by its unique ID. Only users with write permissions have
456
- * access to update this resource.
364
+ * Update a file by its unique ID. Only users with write permissions have access to update this resource.
457
365
  *
458
366
  * @param {string} bucketId
459
367
  * @param {string} fileId
460
368
  * @param {string} name
461
369
  * @param {string[]} permissions
462
370
  * @throws {AppwriteException}
463
- * @returns {Promise}
371
+ * @returns {Promise<Models.File>}
464
372
  */
465
- async updateFile(bucketId, fileId, name, permissions) {
466
- const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
467
- let payload = {};
373
+ async updateFile(bucketId: string, fileId: string, name?: string, permissions?: string[]): Promise<Models.File> {
468
374
  if (typeof bucketId === 'undefined') {
469
375
  throw new AppwriteException('Missing required parameter: "bucketId"');
470
376
  }
471
-
472
377
  if (typeof fileId === 'undefined') {
473
378
  throw new AppwriteException('Missing required parameter: "fileId"');
474
379
  }
475
-
476
-
380
+ const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
381
+ const payload: Payload = {};
477
382
  if (typeof name !== 'undefined') {
478
383
  payload['name'] = name;
479
384
  }
480
-
481
385
  if (typeof permissions !== 'undefined') {
482
386
  payload['permissions'] = permissions;
483
387
  }
388
+ const uri = new URL(this.client.config.endpoint + apiPath);
484
389
 
485
- return await this.client.call('put', apiPath, {
390
+ const apiHeaders: { [header: string]: string } = {
486
391
  'content-type': 'application/json',
487
- }, payload);
488
- }
392
+ }
489
393
 
394
+ return await this.client.call(
395
+ 'put',
396
+ uri,
397
+ apiHeaders,
398
+ payload,
399
+ );
400
+ }
490
401
  /**
491
402
  * Delete File
492
403
  *
493
- * Delete a file by its unique ID. Only users with write permissions have
494
- * access to delete this resource.
404
+ * Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
495
405
  *
496
406
  * @param {string} bucketId
497
407
  * @param {string} fileId
498
408
  * @throws {AppwriteException}
499
- * @returns {Promise}
409
+ * @returns {Promise<{}>}
500
410
  */
501
- async deleteFile(bucketId, fileId) {
502
- const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
503
- let payload = {};
411
+ async deleteFile(bucketId: string, fileId: string): Promise<{}> {
504
412
  if (typeof bucketId === 'undefined') {
505
413
  throw new AppwriteException('Missing required parameter: "bucketId"');
506
414
  }
507
-
508
415
  if (typeof fileId === 'undefined') {
509
416
  throw new AppwriteException('Missing required parameter: "fileId"');
510
417
  }
418
+ const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
419
+ const payload: Payload = {};
420
+ const uri = new URL(this.client.config.endpoint + apiPath);
511
421
 
512
-
513
- return await this.client.call('delete', apiPath, {
422
+ const apiHeaders: { [header: string]: string } = {
514
423
  'content-type': 'application/json',
515
- }, payload);
516
- }
424
+ }
517
425
 
426
+ return await this.client.call(
427
+ 'delete',
428
+ uri,
429
+ apiHeaders,
430
+ payload,
431
+ );
432
+ }
518
433
  /**
519
434
  * Get file for download
520
435
  *
521
- * Get a file content by its unique ID. The endpoint response return with a
522
- * 'Content-Disposition: attachment' header that tells the browser to start
523
- * downloading the file to user downloads directory.
436
+ * Get a file content by its unique ID. The endpoint response return with a &#039;Content-Disposition: attachment&#039; header that tells the browser to start downloading the file to user downloads directory.
524
437
  *
525
438
  * @param {string} bucketId
526
439
  * @param {string} fileId
527
440
  * @throws {AppwriteException}
528
- * @returns {Promise}
441
+ * @returns {Promise<ArrayBuffer>}
529
442
  */
530
- async getFileDownload(bucketId, fileId) {
531
- const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
532
- let payload = {};
443
+ async getFileDownload(bucketId: string, fileId: string): Promise<ArrayBuffer> {
533
444
  if (typeof bucketId === 'undefined') {
534
445
  throw new AppwriteException('Missing required parameter: "bucketId"');
535
446
  }
536
-
537
447
  if (typeof fileId === 'undefined') {
538
448
  throw new AppwriteException('Missing required parameter: "fileId"');
539
449
  }
450
+ const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
451
+ const payload: Payload = {};
452
+ const uri = new URL(this.client.config.endpoint + apiPath);
540
453
 
541
-
542
- return await this.client.call('get', apiPath, {
454
+ const apiHeaders: { [header: string]: string } = {
543
455
  'content-type': 'application/json',
544
- }, payload, 'arraybuffer');
545
- }
456
+ }
546
457
 
458
+ return await this.client.call(
459
+ 'get',
460
+ uri,
461
+ apiHeaders,
462
+ payload,
463
+ 'arrayBuffer'
464
+ );
465
+ }
547
466
  /**
548
467
  * Get file preview
549
468
  *
550
- * Get a file preview image. Currently, this method supports preview for image
551
- * files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
552
- * and spreadsheets, will return the file icon image. You can also pass query
553
- * string arguments for cutting and resizing your preview image. Preview is
554
- * supported only for image files smaller than 10MB.
469
+ * Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB.
555
470
  *
556
471
  * @param {string} bucketId
557
472
  * @param {string} fileId
@@ -567,97 +482,95 @@ class Storage extends Service {
567
482
  * @param {string} background
568
483
  * @param {ImageFormat} output
569
484
  * @throws {AppwriteException}
570
- * @returns {Promise}
485
+ * @returns {Promise<ArrayBuffer>}
571
486
  */
572
- async getFilePreview(bucketId, fileId, width, height, gravity, quality, borderWidth, borderColor, borderRadius, opacity, rotation, background, output) {
573
- const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
574
- let payload = {};
487
+ async getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat): Promise<ArrayBuffer> {
575
488
  if (typeof bucketId === 'undefined') {
576
489
  throw new AppwriteException('Missing required parameter: "bucketId"');
577
490
  }
578
-
579
491
  if (typeof fileId === 'undefined') {
580
492
  throw new AppwriteException('Missing required parameter: "fileId"');
581
493
  }
582
-
583
-
494
+ const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
495
+ const payload: Payload = {};
584
496
  if (typeof width !== 'undefined') {
585
497
  payload['width'] = width;
586
498
  }
587
-
588
499
  if (typeof height !== 'undefined') {
589
500
  payload['height'] = height;
590
501
  }
591
-
592
502
  if (typeof gravity !== 'undefined') {
593
503
  payload['gravity'] = gravity;
594
504
  }
595
-
596
505
  if (typeof quality !== 'undefined') {
597
506
  payload['quality'] = quality;
598
507
  }
599
-
600
508
  if (typeof borderWidth !== 'undefined') {
601
509
  payload['borderWidth'] = borderWidth;
602
510
  }
603
-
604
511
  if (typeof borderColor !== 'undefined') {
605
512
  payload['borderColor'] = borderColor;
606
513
  }
607
-
608
514
  if (typeof borderRadius !== 'undefined') {
609
515
  payload['borderRadius'] = borderRadius;
610
516
  }
611
-
612
517
  if (typeof opacity !== 'undefined') {
613
518
  payload['opacity'] = opacity;
614
519
  }
615
-
616
520
  if (typeof rotation !== 'undefined') {
617
521
  payload['rotation'] = rotation;
618
522
  }
619
-
620
523
  if (typeof background !== 'undefined') {
621
524
  payload['background'] = background;
622
525
  }
623
-
624
526
  if (typeof output !== 'undefined') {
625
527
  payload['output'] = output;
626
528
  }
529
+ const uri = new URL(this.client.config.endpoint + apiPath);
627
530
 
628
- return await this.client.call('get', apiPath, {
531
+ const apiHeaders: { [header: string]: string } = {
629
532
  'content-type': 'application/json',
630
- }, payload, 'arraybuffer');
631
- }
533
+ }
632
534
 
535
+ return await this.client.call(
536
+ 'get',
537
+ uri,
538
+ apiHeaders,
539
+ payload,
540
+ 'arrayBuffer'
541
+ );
542
+ }
633
543
  /**
634
544
  * Get file for view
635
545
  *
636
- * Get a file content by its unique ID. This endpoint is similar to the
637
- * download method but returns with no 'Content-Disposition: attachment'
638
- * header.
546
+ * Get a file content by its unique ID. This endpoint is similar to the download method but returns with no &#039;Content-Disposition: attachment&#039; header.
639
547
  *
640
548
  * @param {string} bucketId
641
549
  * @param {string} fileId
642
550
  * @throws {AppwriteException}
643
- * @returns {Promise}
551
+ * @returns {Promise<ArrayBuffer>}
644
552
  */
645
- async getFileView(bucketId, fileId) {
646
- const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
647
- let payload = {};
553
+ async getFileView(bucketId: string, fileId: string): Promise<ArrayBuffer> {
648
554
  if (typeof bucketId === 'undefined') {
649
555
  throw new AppwriteException('Missing required parameter: "bucketId"');
650
556
  }
651
-
652
557
  if (typeof fileId === 'undefined') {
653
558
  throw new AppwriteException('Missing required parameter: "fileId"');
654
559
  }
560
+ const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
561
+ const payload: Payload = {};
562
+ const uri = new URL(this.client.config.endpoint + apiPath);
655
563
 
656
-
657
- return await this.client.call('get', apiPath, {
564
+ const apiHeaders: { [header: string]: string } = {
658
565
  'content-type': 'application/json',
659
- }, payload, 'arraybuffer');
566
+ }
567
+
568
+ return await this.client.call(
569
+ 'get',
570
+ uri,
571
+ apiHeaders,
572
+ payload,
573
+ 'arrayBuffer'
574
+ );
660
575
  }
661
576
  }
662
-
663
- module.exports = Storage;