node-appwrite 9.0.0 → 10.0.0

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 (182) hide show
  1. package/README.md +2 -2
  2. package/docs/examples/account/create-phone-verification.md +1 -1
  3. package/docs/examples/account/create-recovery.md +1 -1
  4. package/docs/examples/account/create-verification.md +1 -1
  5. package/docs/examples/account/delete-identity.md +20 -0
  6. package/docs/examples/account/delete-session.md +1 -1
  7. package/docs/examples/account/delete-sessions.md +1 -1
  8. package/docs/examples/account/get-prefs.md +1 -1
  9. package/docs/examples/account/get-session.md +1 -1
  10. package/docs/examples/account/get.md +1 -1
  11. package/docs/examples/account/list-identities.md +20 -0
  12. package/docs/examples/account/list-logs.md +1 -1
  13. package/docs/examples/account/list-sessions.md +1 -1
  14. package/docs/examples/account/update-email.md +1 -1
  15. package/docs/examples/account/update-name.md +1 -1
  16. package/docs/examples/account/update-password.md +1 -1
  17. package/docs/examples/account/update-phone-verification.md +1 -1
  18. package/docs/examples/account/update-phone.md +1 -1
  19. package/docs/examples/account/update-prefs.md +1 -1
  20. package/docs/examples/account/update-recovery.md +1 -1
  21. package/docs/examples/account/update-session.md +1 -1
  22. package/docs/examples/account/update-status.md +1 -1
  23. package/docs/examples/account/update-verification.md +1 -1
  24. package/docs/examples/avatars/get-browser.md +1 -1
  25. package/docs/examples/avatars/get-credit-card.md +1 -1
  26. package/docs/examples/avatars/get-favicon.md +1 -1
  27. package/docs/examples/avatars/get-flag.md +1 -1
  28. package/docs/examples/avatars/get-image.md +1 -1
  29. package/docs/examples/avatars/get-initials.md +1 -1
  30. package/docs/examples/avatars/get-q-r.md +1 -1
  31. package/docs/examples/databases/create-boolean-attribute.md +1 -1
  32. package/docs/examples/databases/create-collection.md +1 -1
  33. package/docs/examples/databases/create-datetime-attribute.md +1 -1
  34. package/docs/examples/databases/create-document.md +1 -1
  35. package/docs/examples/databases/create-email-attribute.md +1 -1
  36. package/docs/examples/databases/create-enum-attribute.md +1 -1
  37. package/docs/examples/databases/create-float-attribute.md +1 -1
  38. package/docs/examples/databases/create-index.md +1 -1
  39. package/docs/examples/databases/create-integer-attribute.md +1 -1
  40. package/docs/examples/databases/create-ip-attribute.md +1 -1
  41. package/docs/examples/databases/create-relationship-attribute.md +1 -1
  42. package/docs/examples/databases/create-string-attribute.md +1 -1
  43. package/docs/examples/databases/create-url-attribute.md +1 -1
  44. package/docs/examples/databases/create.md +1 -1
  45. package/docs/examples/databases/delete-attribute.md +1 -1
  46. package/docs/examples/databases/delete-collection.md +1 -1
  47. package/docs/examples/databases/delete-document.md +1 -1
  48. package/docs/examples/databases/delete-index.md +1 -1
  49. package/docs/examples/databases/delete.md +1 -1
  50. package/docs/examples/databases/get-attribute.md +1 -1
  51. package/docs/examples/databases/get-collection.md +1 -1
  52. package/docs/examples/databases/get-document.md +1 -1
  53. package/docs/examples/databases/get-index.md +1 -1
  54. package/docs/examples/databases/get.md +1 -1
  55. package/docs/examples/databases/list-attributes.md +1 -1
  56. package/docs/examples/databases/list-collections.md +1 -1
  57. package/docs/examples/databases/list-documents.md +1 -1
  58. package/docs/examples/databases/list-indexes.md +1 -1
  59. package/docs/examples/databases/list.md +1 -1
  60. package/docs/examples/databases/update-boolean-attribute.md +1 -1
  61. package/docs/examples/databases/update-collection.md +1 -1
  62. package/docs/examples/databases/update-datetime-attribute.md +1 -1
  63. package/docs/examples/databases/update-document.md +1 -1
  64. package/docs/examples/databases/update-email-attribute.md +1 -1
  65. package/docs/examples/databases/update-enum-attribute.md +1 -1
  66. package/docs/examples/databases/update-float-attribute.md +1 -1
  67. package/docs/examples/databases/update-integer-attribute.md +1 -1
  68. package/docs/examples/databases/update-ip-attribute.md +1 -1
  69. package/docs/examples/databases/update-relationship-attribute.md +1 -1
  70. package/docs/examples/databases/update-string-attribute.md +1 -1
  71. package/docs/examples/databases/update-url-attribute.md +1 -1
  72. package/docs/examples/databases/update.md +1 -1
  73. package/docs/examples/functions/create-build.md +1 -1
  74. package/docs/examples/functions/create-deployment.md +2 -2
  75. package/docs/examples/functions/create-execution.md +1 -1
  76. package/docs/examples/functions/create-variable.md +1 -1
  77. package/docs/examples/functions/create.md +1 -1
  78. package/docs/examples/functions/delete-deployment.md +1 -1
  79. package/docs/examples/functions/delete-variable.md +1 -1
  80. package/docs/examples/functions/delete.md +1 -1
  81. package/docs/examples/functions/download-deployment.md +20 -0
  82. package/docs/examples/functions/get-deployment.md +1 -1
  83. package/docs/examples/functions/get-execution.md +1 -1
  84. package/docs/examples/functions/get-variable.md +1 -1
  85. package/docs/examples/functions/get.md +1 -1
  86. package/docs/examples/functions/list-deployments.md +1 -1
  87. package/docs/examples/functions/list-executions.md +1 -1
  88. package/docs/examples/functions/list-runtimes.md +1 -1
  89. package/docs/examples/functions/list-variables.md +1 -1
  90. package/docs/examples/functions/list.md +1 -1
  91. package/docs/examples/functions/update-deployment.md +1 -1
  92. package/docs/examples/functions/update-variable.md +1 -1
  93. package/docs/examples/functions/update.md +2 -2
  94. package/docs/examples/graphql/mutation.md +1 -1
  95. package/docs/examples/graphql/query.md +1 -1
  96. package/docs/examples/health/get-antivirus.md +1 -1
  97. package/docs/examples/health/get-cache.md +1 -1
  98. package/docs/examples/health/get-d-b.md +1 -1
  99. package/docs/examples/health/get-pub-sub.md +20 -0
  100. package/docs/examples/health/get-queue-certificates.md +1 -1
  101. package/docs/examples/health/get-queue-functions.md +1 -1
  102. package/docs/examples/health/get-queue-logs.md +1 -1
  103. package/docs/examples/health/get-queue-webhooks.md +1 -1
  104. package/docs/examples/health/get-queue.md +20 -0
  105. package/docs/examples/health/get-storage-local.md +1 -1
  106. package/docs/examples/health/get-time.md +1 -1
  107. package/docs/examples/health/get.md +1 -1
  108. package/docs/examples/locale/get.md +1 -1
  109. package/docs/examples/locale/list-codes.md +20 -0
  110. package/docs/examples/locale/list-continents.md +1 -1
  111. package/docs/examples/locale/list-countries-e-u.md +1 -1
  112. package/docs/examples/locale/list-countries-phones.md +1 -1
  113. package/docs/examples/locale/list-countries.md +1 -1
  114. package/docs/examples/locale/list-currencies.md +1 -1
  115. package/docs/examples/locale/list-languages.md +1 -1
  116. package/docs/examples/storage/create-bucket.md +1 -1
  117. package/docs/examples/storage/create-file.md +1 -1
  118. package/docs/examples/storage/delete-bucket.md +1 -1
  119. package/docs/examples/storage/delete-file.md +1 -1
  120. package/docs/examples/storage/get-bucket.md +1 -1
  121. package/docs/examples/storage/get-file-download.md +1 -1
  122. package/docs/examples/storage/get-file-preview.md +1 -1
  123. package/docs/examples/storage/get-file-view.md +1 -1
  124. package/docs/examples/storage/get-file.md +1 -1
  125. package/docs/examples/storage/list-buckets.md +1 -1
  126. package/docs/examples/storage/list-files.md +1 -1
  127. package/docs/examples/storage/update-bucket.md +1 -1
  128. package/docs/examples/storage/update-file.md +1 -1
  129. package/docs/examples/teams/create-membership.md +1 -1
  130. package/docs/examples/teams/create.md +1 -1
  131. package/docs/examples/teams/delete-membership.md +1 -1
  132. package/docs/examples/teams/delete.md +1 -1
  133. package/docs/examples/teams/get-membership.md +1 -1
  134. package/docs/examples/teams/get-prefs.md +1 -1
  135. package/docs/examples/teams/get.md +1 -1
  136. package/docs/examples/teams/list-memberships.md +1 -1
  137. package/docs/examples/teams/list.md +1 -1
  138. package/docs/examples/teams/update-membership-status.md +1 -1
  139. package/docs/examples/teams/{update-membership-roles.md → update-membership.md} +2 -2
  140. package/docs/examples/teams/update-name.md +1 -1
  141. package/docs/examples/teams/update-prefs.md +1 -1
  142. package/docs/examples/users/create-argon2user.md +1 -1
  143. package/docs/examples/users/create-bcrypt-user.md +1 -1
  144. package/docs/examples/users/create-m-d5user.md +1 -1
  145. package/docs/examples/users/create-p-h-pass-user.md +1 -1
  146. package/docs/examples/users/create-s-h-a-user.md +1 -1
  147. package/docs/examples/users/create-scrypt-modified-user.md +1 -1
  148. package/docs/examples/users/create-scrypt-user.md +1 -1
  149. package/docs/examples/users/create.md +1 -1
  150. package/docs/examples/users/delete-identity.md +20 -0
  151. package/docs/examples/users/delete-session.md +1 -1
  152. package/docs/examples/users/delete-sessions.md +1 -1
  153. package/docs/examples/users/delete.md +1 -1
  154. package/docs/examples/users/get-prefs.md +1 -1
  155. package/docs/examples/users/get.md +1 -1
  156. package/docs/examples/users/list-identities.md +20 -0
  157. package/docs/examples/users/list-logs.md +1 -1
  158. package/docs/examples/users/list-memberships.md +1 -1
  159. package/docs/examples/users/list-sessions.md +1 -1
  160. package/docs/examples/users/list.md +1 -1
  161. package/docs/examples/users/update-email-verification.md +1 -1
  162. package/docs/examples/users/update-email.md +1 -1
  163. package/docs/examples/users/update-labels.md +20 -0
  164. package/docs/examples/users/update-name.md +1 -1
  165. package/docs/examples/users/update-password.md +1 -1
  166. package/docs/examples/users/update-phone-verification.md +1 -1
  167. package/docs/examples/users/update-phone.md +1 -1
  168. package/docs/examples/users/update-prefs.md +1 -1
  169. package/docs/examples/users/update-status.md +1 -1
  170. package/index.d.ts +435 -55
  171. package/lib/client.js +4 -2
  172. package/lib/services/account.js +94 -50
  173. package/lib/services/avatars.js +14 -14
  174. package/lib/services/databases.js +120 -90
  175. package/lib/services/functions.js +212 -59
  176. package/lib/services/graphql.js +4 -4
  177. package/lib/services/health.js +57 -22
  178. package/lib/services/locale.js +32 -14
  179. package/lib/services/storage.js +33 -28
  180. package/lib/services/teams.js +29 -28
  181. package/lib/services/users.js +135 -50
  182. package/package.json +2 -2
@@ -23,10 +23,10 @@ class Health extends Service {
23
23
  * @returns {Promise}
24
24
  */
25
25
  async get() {
26
- let path = '/health';
26
+ const apiPath = '/health';
27
27
  let payload = {};
28
28
 
29
- return await this.client.call('get', path, {
29
+ return await this.client.call('get', apiPath, {
30
30
  'content-type': 'application/json',
31
31
  }, payload);
32
32
  }
@@ -40,10 +40,10 @@ class Health extends Service {
40
40
  * @returns {Promise}
41
41
  */
42
42
  async getAntivirus() {
43
- let path = '/health/anti-virus';
43
+ const apiPath = '/health/anti-virus';
44
44
  let payload = {};
45
45
 
46
- return await this.client.call('get', path, {
46
+ return await this.client.call('get', apiPath, {
47
47
  'content-type': 'application/json',
48
48
  }, payload);
49
49
  }
@@ -51,17 +51,17 @@ class Health extends Service {
51
51
  /**
52
52
  * Get Cache
53
53
  *
54
- * Check the Appwrite in-memory cache server is up and connection is
54
+ * Check the Appwrite in-memory cache servers are up and connection is
55
55
  * successful.
56
56
  *
57
57
  * @throws {AppwriteException}
58
58
  * @returns {Promise}
59
59
  */
60
60
  async getCache() {
61
- let path = '/health/cache';
61
+ const apiPath = '/health/cache';
62
62
  let payload = {};
63
63
 
64
- return await this.client.call('get', path, {
64
+ return await this.client.call('get', apiPath, {
65
65
  'content-type': 'application/json',
66
66
  }, payload);
67
67
  }
@@ -69,16 +69,51 @@ class Health extends Service {
69
69
  /**
70
70
  * Get DB
71
71
  *
72
- * Check the Appwrite database server is up and connection is successful.
72
+ * Check the Appwrite database servers are up and connection is successful.
73
73
  *
74
74
  * @throws {AppwriteException}
75
75
  * @returns {Promise}
76
76
  */
77
77
  async getDB() {
78
- let path = '/health/db';
78
+ const apiPath = '/health/db';
79
79
  let payload = {};
80
80
 
81
- return await this.client.call('get', path, {
81
+ return await this.client.call('get', apiPath, {
82
+ 'content-type': 'application/json',
83
+ }, payload);
84
+ }
85
+
86
+ /**
87
+ * Get PubSub
88
+ *
89
+ * Check the Appwrite pub-sub servers are up and connection is successful.
90
+ *
91
+ * @throws {AppwriteException}
92
+ * @returns {Promise}
93
+ */
94
+ async getPubSub() {
95
+ const apiPath = '/health/pubsub';
96
+ let payload = {};
97
+
98
+ return await this.client.call('get', apiPath, {
99
+ 'content-type': 'application/json',
100
+ }, payload);
101
+ }
102
+
103
+ /**
104
+ * Get Queue
105
+ *
106
+ * Check the Appwrite queue messaging servers are up and connection is
107
+ * successful.
108
+ *
109
+ * @throws {AppwriteException}
110
+ * @returns {Promise}
111
+ */
112
+ async getQueue() {
113
+ const apiPath = '/health/queue';
114
+ let payload = {};
115
+
116
+ return await this.client.call('get', apiPath, {
82
117
  'content-type': 'application/json',
83
118
  }, payload);
84
119
  }
@@ -94,10 +129,10 @@ class Health extends Service {
94
129
  * @returns {Promise}
95
130
  */
96
131
  async getQueueCertificates() {
97
- let path = '/health/queue/certificates';
132
+ const apiPath = '/health/queue/certificates';
98
133
  let payload = {};
99
134
 
100
- return await this.client.call('get', path, {
135
+ return await this.client.call('get', apiPath, {
101
136
  'content-type': 'application/json',
102
137
  }, payload);
103
138
  }
@@ -109,10 +144,10 @@ class Health extends Service {
109
144
  * @returns {Promise}
110
145
  */
111
146
  async getQueueFunctions() {
112
- let path = '/health/queue/functions';
147
+ const apiPath = '/health/queue/functions';
113
148
  let payload = {};
114
149
 
115
- return await this.client.call('get', path, {
150
+ return await this.client.call('get', apiPath, {
116
151
  'content-type': 'application/json',
117
152
  }, payload);
118
153
  }
@@ -127,10 +162,10 @@ class Health extends Service {
127
162
  * @returns {Promise}
128
163
  */
129
164
  async getQueueLogs() {
130
- let path = '/health/queue/logs';
165
+ const apiPath = '/health/queue/logs';
131
166
  let payload = {};
132
167
 
133
- return await this.client.call('get', path, {
168
+ return await this.client.call('get', apiPath, {
134
169
  'content-type': 'application/json',
135
170
  }, payload);
136
171
  }
@@ -145,10 +180,10 @@ class Health extends Service {
145
180
  * @returns {Promise}
146
181
  */
147
182
  async getQueueWebhooks() {
148
- let path = '/health/queue/webhooks';
183
+ const apiPath = '/health/queue/webhooks';
149
184
  let payload = {};
150
185
 
151
- return await this.client.call('get', path, {
186
+ return await this.client.call('get', apiPath, {
152
187
  'content-type': 'application/json',
153
188
  }, payload);
154
189
  }
@@ -162,10 +197,10 @@ class Health extends Service {
162
197
  * @returns {Promise}
163
198
  */
164
199
  async getStorageLocal() {
165
- let path = '/health/storage/local';
200
+ const apiPath = '/health/storage/local';
166
201
  let payload = {};
167
202
 
168
- return await this.client.call('get', path, {
203
+ return await this.client.call('get', apiPath, {
169
204
  'content-type': 'application/json',
170
205
  }, payload);
171
206
  }
@@ -185,10 +220,10 @@ class Health extends Service {
185
220
  * @returns {Promise}
186
221
  */
187
222
  async getTime() {
188
- let path = '/health/time';
223
+ const apiPath = '/health/time';
189
224
  let payload = {};
190
225
 
191
- return await this.client.call('get', path, {
226
+ return await this.client.call('get', apiPath, {
192
227
  'content-type': 'application/json',
193
228
  }, payload);
194
229
  }
@@ -28,10 +28,28 @@ class Locale extends Service {
28
28
  * @returns {Promise}
29
29
  */
30
30
  async get() {
31
- let path = '/locale';
31
+ const apiPath = '/locale';
32
32
  let payload = {};
33
33
 
34
- return await this.client.call('get', path, {
34
+ return await this.client.call('get', apiPath, {
35
+ 'content-type': 'application/json',
36
+ }, payload);
37
+ }
38
+
39
+ /**
40
+ * List Locale Codes
41
+ *
42
+ * List of all locale codes in [ISO
43
+ * 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
44
+ *
45
+ * @throws {AppwriteException}
46
+ * @returns {Promise}
47
+ */
48
+ async listCodes() {
49
+ const apiPath = '/locale/codes';
50
+ let payload = {};
51
+
52
+ return await this.client.call('get', apiPath, {
35
53
  'content-type': 'application/json',
36
54
  }, payload);
37
55
  }
@@ -46,10 +64,10 @@ class Locale extends Service {
46
64
  * @returns {Promise}
47
65
  */
48
66
  async listContinents() {
49
- let path = '/locale/continents';
67
+ const apiPath = '/locale/continents';
50
68
  let payload = {};
51
69
 
52
- return await this.client.call('get', path, {
70
+ return await this.client.call('get', apiPath, {
53
71
  'content-type': 'application/json',
54
72
  }, payload);
55
73
  }
@@ -64,10 +82,10 @@ class Locale extends Service {
64
82
  * @returns {Promise}
65
83
  */
66
84
  async listCountries() {
67
- let path = '/locale/countries';
85
+ const apiPath = '/locale/countries';
68
86
  let payload = {};
69
87
 
70
- return await this.client.call('get', path, {
88
+ return await this.client.call('get', apiPath, {
71
89
  'content-type': 'application/json',
72
90
  }, payload);
73
91
  }
@@ -82,10 +100,10 @@ class Locale extends Service {
82
100
  * @returns {Promise}
83
101
  */
84
102
  async listCountriesEU() {
85
- let path = '/locale/countries/eu';
103
+ const apiPath = '/locale/countries/eu';
86
104
  let payload = {};
87
105
 
88
- return await this.client.call('get', path, {
106
+ return await this.client.call('get', apiPath, {
89
107
  'content-type': 'application/json',
90
108
  }, payload);
91
109
  }
@@ -100,10 +118,10 @@ class Locale extends Service {
100
118
  * @returns {Promise}
101
119
  */
102
120
  async listCountriesPhones() {
103
- let path = '/locale/countries/phones';
121
+ const apiPath = '/locale/countries/phones';
104
122
  let payload = {};
105
123
 
106
- return await this.client.call('get', path, {
124
+ return await this.client.call('get', apiPath, {
107
125
  'content-type': 'application/json',
108
126
  }, payload);
109
127
  }
@@ -119,10 +137,10 @@ class Locale extends Service {
119
137
  * @returns {Promise}
120
138
  */
121
139
  async listCurrencies() {
122
- let path = '/locale/currencies';
140
+ const apiPath = '/locale/currencies';
123
141
  let payload = {};
124
142
 
125
- return await this.client.call('get', path, {
143
+ return await this.client.call('get', apiPath, {
126
144
  'content-type': 'application/json',
127
145
  }, payload);
128
146
  }
@@ -137,10 +155,10 @@ class Locale extends Service {
137
155
  * @returns {Promise}
138
156
  */
139
157
  async listLanguages() {
140
- let path = '/locale/languages';
158
+ const apiPath = '/locale/languages';
141
159
  let payload = {};
142
160
 
143
- return await this.client.call('get', path, {
161
+ return await this.client.call('get', apiPath, {
144
162
  'content-type': 'application/json',
145
163
  }, payload);
146
164
  }
@@ -26,7 +26,7 @@ class Storage extends Service {
26
26
  * @returns {Promise}
27
27
  */
28
28
  async listBuckets(queries, search) {
29
- let path = '/storage/buckets';
29
+ const apiPath = '/storage/buckets';
30
30
  let payload = {};
31
31
 
32
32
  if (typeof queries !== 'undefined') {
@@ -37,7 +37,7 @@ class Storage extends Service {
37
37
  payload['search'] = search;
38
38
  }
39
39
 
40
- return await this.client.call('get', path, {
40
+ return await this.client.call('get', apiPath, {
41
41
  'content-type': 'application/json',
42
42
  }, payload);
43
43
  }
@@ -61,7 +61,7 @@ class Storage extends Service {
61
61
  * @returns {Promise}
62
62
  */
63
63
  async createBucket(bucketId, name, permissions, fileSecurity, enabled, maximumFileSize, allowedFileExtensions, compression, encryption, antivirus) {
64
- let path = '/storage/buckets';
64
+ const apiPath = '/storage/buckets';
65
65
  let payload = {};
66
66
  if (typeof bucketId === 'undefined') {
67
67
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -112,7 +112,7 @@ class Storage extends Service {
112
112
  payload['antivirus'] = antivirus;
113
113
  }
114
114
 
115
- return await this.client.call('post', path, {
115
+ return await this.client.call('post', apiPath, {
116
116
  'content-type': 'application/json',
117
117
  }, payload);
118
118
  }
@@ -128,14 +128,14 @@ class Storage extends Service {
128
128
  * @returns {Promise}
129
129
  */
130
130
  async getBucket(bucketId) {
131
- let path = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
131
+ const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
132
132
  let payload = {};
133
133
  if (typeof bucketId === 'undefined') {
134
134
  throw new AppwriteException('Missing required parameter: "bucketId"');
135
135
  }
136
136
 
137
137
 
138
- return await this.client.call('get', path, {
138
+ return await this.client.call('get', apiPath, {
139
139
  'content-type': 'application/json',
140
140
  }, payload);
141
141
  }
@@ -159,7 +159,7 @@ class Storage extends Service {
159
159
  * @returns {Promise}
160
160
  */
161
161
  async updateBucket(bucketId, name, permissions, fileSecurity, enabled, maximumFileSize, allowedFileExtensions, compression, encryption, antivirus) {
162
- let path = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
162
+ const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
163
163
  let payload = {};
164
164
  if (typeof bucketId === 'undefined') {
165
165
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -206,7 +206,7 @@ class Storage extends Service {
206
206
  payload['antivirus'] = antivirus;
207
207
  }
208
208
 
209
- return await this.client.call('put', path, {
209
+ return await this.client.call('put', apiPath, {
210
210
  'content-type': 'application/json',
211
211
  }, payload);
212
212
  }
@@ -221,14 +221,14 @@ class Storage extends Service {
221
221
  * @returns {Promise}
222
222
  */
223
223
  async deleteBucket(bucketId) {
224
- let path = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
224
+ const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
225
225
  let payload = {};
226
226
  if (typeof bucketId === 'undefined') {
227
227
  throw new AppwriteException('Missing required parameter: "bucketId"');
228
228
  }
229
229
 
230
230
 
231
- return await this.client.call('delete', path, {
231
+ return await this.client.call('delete', apiPath, {
232
232
  'content-type': 'application/json',
233
233
  }, payload);
234
234
  }
@@ -246,7 +246,7 @@ class Storage extends Service {
246
246
  * @returns {Promise}
247
247
  */
248
248
  async listFiles(bucketId, queries, search) {
249
- let path = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
249
+ const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
250
250
  let payload = {};
251
251
  if (typeof bucketId === 'undefined') {
252
252
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -261,7 +261,7 @@ class Storage extends Service {
261
261
  payload['search'] = search;
262
262
  }
263
263
 
264
- return await this.client.call('get', path, {
264
+ return await this.client.call('get', apiPath, {
265
265
  'content-type': 'application/json',
266
266
  }, payload);
267
267
  }
@@ -296,7 +296,7 @@ class Storage extends Service {
296
296
  * @returns {Promise}
297
297
  */
298
298
  async createFile(bucketId, fileId, file, permissions, onProgress = () => {}) {
299
- let path = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
299
+ const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
300
300
  let payload = {};
301
301
  if (typeof bucketId === 'undefined') {
302
302
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -336,7 +336,7 @@ class Storage extends Service {
336
336
 
337
337
  if(fileId != 'unique()') {
338
338
  try {
339
- response = await this.client.call('get', path + '/' + fileId, headers);
339
+ response = await this.client.call('get', apiPath + '/' + fileId, headers);
340
340
  chunksUploaded = response.chunksUploaded;
341
341
  } catch(e) {
342
342
  }
@@ -367,7 +367,7 @@ class Storage extends Service {
367
367
  const stream = Stream.Readable.from(currentChunk);
368
368
  payload['file'] = { type: 'file', file: stream, filename: file.filename };
369
369
 
370
- response = await selfClient.call('post', path, headers, payload);
370
+ response = await selfClient.call('post', apiPath, headers, payload);
371
371
 
372
372
  if (!id) {
373
373
  id = response['$id'];
@@ -464,7 +464,7 @@ class Storage extends Service {
464
464
  * @returns {Promise}
465
465
  */
466
466
  async getFile(bucketId, fileId) {
467
- let path = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
467
+ const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
468
468
  let payload = {};
469
469
  if (typeof bucketId === 'undefined') {
470
470
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -475,7 +475,7 @@ class Storage extends Service {
475
475
  }
476
476
 
477
477
 
478
- return await this.client.call('get', path, {
478
+ return await this.client.call('get', apiPath, {
479
479
  'content-type': 'application/json',
480
480
  }, payload);
481
481
  }
@@ -488,12 +488,13 @@ class Storage extends Service {
488
488
  *
489
489
  * @param {string} bucketId
490
490
  * @param {string} fileId
491
+ * @param {string} name
491
492
  * @param {string[]} permissions
492
493
  * @throws {AppwriteException}
493
494
  * @returns {Promise}
494
495
  */
495
- async updateFile(bucketId, fileId, permissions) {
496
- let path = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
496
+ async updateFile(bucketId, fileId, name, permissions) {
497
+ const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
497
498
  let payload = {};
498
499
  if (typeof bucketId === 'undefined') {
499
500
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -504,11 +505,15 @@ class Storage extends Service {
504
505
  }
505
506
 
506
507
 
508
+ if (typeof name !== 'undefined') {
509
+ payload['name'] = name;
510
+ }
511
+
507
512
  if (typeof permissions !== 'undefined') {
508
513
  payload['permissions'] = permissions;
509
514
  }
510
515
 
511
- return await this.client.call('put', path, {
516
+ return await this.client.call('put', apiPath, {
512
517
  'content-type': 'application/json',
513
518
  }, payload);
514
519
  }
@@ -525,7 +530,7 @@ class Storage extends Service {
525
530
  * @returns {Promise}
526
531
  */
527
532
  async deleteFile(bucketId, fileId) {
528
- let path = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
533
+ const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
529
534
  let payload = {};
530
535
  if (typeof bucketId === 'undefined') {
531
536
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -536,7 +541,7 @@ class Storage extends Service {
536
541
  }
537
542
 
538
543
 
539
- return await this.client.call('delete', path, {
544
+ return await this.client.call('delete', apiPath, {
540
545
  'content-type': 'application/json',
541
546
  }, payload);
542
547
  }
@@ -554,7 +559,7 @@ class Storage extends Service {
554
559
  * @returns {Promise}
555
560
  */
556
561
  async getFileDownload(bucketId, fileId) {
557
- let path = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
562
+ const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
558
563
  let payload = {};
559
564
  if (typeof bucketId === 'undefined') {
560
565
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -565,7 +570,7 @@ class Storage extends Service {
565
570
  }
566
571
 
567
572
 
568
- return await this.client.call('get', path, {
573
+ return await this.client.call('get', apiPath, {
569
574
  'content-type': 'application/json',
570
575
  }, payload, 'arraybuffer');
571
576
  }
@@ -596,7 +601,7 @@ class Storage extends Service {
596
601
  * @returns {Promise}
597
602
  */
598
603
  async getFilePreview(bucketId, fileId, width, height, gravity, quality, borderWidth, borderColor, borderRadius, opacity, rotation, background, output) {
599
- let path = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
604
+ const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
600
605
  let payload = {};
601
606
  if (typeof bucketId === 'undefined') {
602
607
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -651,7 +656,7 @@ class Storage extends Service {
651
656
  payload['output'] = output;
652
657
  }
653
658
 
654
- return await this.client.call('get', path, {
659
+ return await this.client.call('get', apiPath, {
655
660
  'content-type': 'application/json',
656
661
  }, payload, 'arraybuffer');
657
662
  }
@@ -669,7 +674,7 @@ class Storage extends Service {
669
674
  * @returns {Promise}
670
675
  */
671
676
  async getFileView(bucketId, fileId) {
672
- let path = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
677
+ const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
673
678
  let payload = {};
674
679
  if (typeof bucketId === 'undefined') {
675
680
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -680,7 +685,7 @@ class Storage extends Service {
680
685
  }
681
686
 
682
687
 
683
- return await this.client.call('get', path, {
688
+ return await this.client.call('get', apiPath, {
684
689
  'content-type': 'application/json',
685
690
  }, payload, 'arraybuffer');
686
691
  }