node-appwrite 2.4.0 → 4.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.
- package/.github/ISSUE_TEMPLATE/bug.yaml +82 -0
- package/.github/ISSUE_TEMPLATE/documentation.yaml +32 -0
- package/.github/ISSUE_TEMPLATE/feature.yaml +40 -0
- package/LICENSE +1 -1
- package/README.md +7 -7
- package/docs/examples/database/create-boolean-attribute.md +20 -0
- package/docs/examples/database/create-collection.md +1 -1
- package/docs/examples/database/create-document.md +1 -1
- package/docs/examples/database/create-email-attribute.md +20 -0
- package/docs/examples/database/create-enum-attribute.md +20 -0
- package/docs/examples/database/create-float-attribute.md +20 -0
- package/docs/examples/database/create-index.md +20 -0
- package/docs/examples/database/create-integer-attribute.md +20 -0
- package/docs/examples/database/create-ip-attribute.md +20 -0
- package/docs/examples/database/create-string-attribute.md +20 -0
- package/docs/examples/database/create-url-attribute.md +20 -0
- package/docs/examples/database/delete-attribute.md +20 -0
- package/docs/examples/database/delete-index.md +20 -0
- package/docs/examples/database/get-attribute.md +20 -0
- package/docs/examples/database/get-index.md +20 -0
- package/docs/examples/database/list-attributes.md +20 -0
- package/docs/examples/database/list-indexes.md +20 -0
- package/docs/examples/database/update-collection.md +1 -1
- package/docs/examples/functions/create-tag.md +1 -1
- package/docs/examples/functions/create.md +1 -1
- package/docs/examples/{health/get-queue-tasks.md → functions/list-runtimes.md} +2 -2
- package/docs/examples/health/{get-anti-virus.md → get-antivirus.md} +1 -1
- package/docs/examples/storage/create-file.md +1 -1
- package/docs/examples/teams/create.md +1 -1
- package/docs/examples/teams/get-membership.md +20 -0
- package/docs/examples/users/create.md +1 -1
- package/docs/examples/users/update-email.md +20 -0
- package/docs/examples/users/update-name.md +20 -0
- package/docs/examples/users/update-password.md +20 -0
- package/docs/examples/users/update-status.md +1 -1
- package/index.d.ts +1693 -235
- package/lib/client.js +5 -5
- package/lib/query.js +34 -0
- package/lib/services/account.js +18 -6
- package/lib/services/database.js +706 -47
- package/lib/services/functions.js +63 -12
- package/lib/services/health.js +4 -22
- package/lib/services/storage.js +21 -2
- package/lib/services/teams.js +93 -31
- package/lib/services/users.js +127 -5
- package/package.json +2 -2
package/lib/services/users.js
CHANGED
|
@@ -12,11 +12,13 @@ class Users extends Service {
|
|
|
12
12
|
* @param {string} search
|
|
13
13
|
* @param {number} limit
|
|
14
14
|
* @param {number} offset
|
|
15
|
+
* @param {string} cursor
|
|
16
|
+
* @param {string} cursorDirection
|
|
15
17
|
* @param {string} orderType
|
|
16
18
|
* @throws {AppwriteException}
|
|
17
19
|
* @returns {Promise}
|
|
18
20
|
*/
|
|
19
|
-
async list(search, limit, offset, orderType) {
|
|
21
|
+
async list(search, limit, offset, cursor, cursorDirection, orderType) {
|
|
20
22
|
let path = '/users';
|
|
21
23
|
let payload = {};
|
|
22
24
|
|
|
@@ -32,6 +34,14 @@ class Users extends Service {
|
|
|
32
34
|
payload['offset'] = offset;
|
|
33
35
|
}
|
|
34
36
|
|
|
37
|
+
if (typeof cursor !== 'undefined') {
|
|
38
|
+
payload['cursor'] = cursor;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (typeof cursorDirection !== 'undefined') {
|
|
42
|
+
payload['cursorDirection'] = cursorDirection;
|
|
43
|
+
}
|
|
44
|
+
|
|
35
45
|
if (typeof orderType !== 'undefined') {
|
|
36
46
|
payload['orderType'] = orderType;
|
|
37
47
|
}
|
|
@@ -46,13 +56,18 @@ class Users extends Service {
|
|
|
46
56
|
*
|
|
47
57
|
* Create a new user.
|
|
48
58
|
*
|
|
59
|
+
* @param {string} userId
|
|
49
60
|
* @param {string} email
|
|
50
61
|
* @param {string} password
|
|
51
62
|
* @param {string} name
|
|
52
63
|
* @throws {AppwriteException}
|
|
53
64
|
* @returns {Promise}
|
|
54
65
|
*/
|
|
55
|
-
async create(email, password, name) {
|
|
66
|
+
async create(userId, email, password, name) {
|
|
67
|
+
if (typeof userId === 'undefined') {
|
|
68
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
69
|
+
}
|
|
70
|
+
|
|
56
71
|
if (typeof email === 'undefined') {
|
|
57
72
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
58
73
|
}
|
|
@@ -64,6 +79,10 @@ class Users extends Service {
|
|
|
64
79
|
let path = '/users';
|
|
65
80
|
let payload = {};
|
|
66
81
|
|
|
82
|
+
if (typeof userId !== 'undefined') {
|
|
83
|
+
payload['userId'] = userId;
|
|
84
|
+
}
|
|
85
|
+
|
|
67
86
|
if (typeof email !== 'undefined') {
|
|
68
87
|
payload['email'] = email;
|
|
69
88
|
}
|
|
@@ -125,16 +144,49 @@ class Users extends Service {
|
|
|
125
144
|
}, payload);
|
|
126
145
|
}
|
|
127
146
|
|
|
147
|
+
/**
|
|
148
|
+
* Update Email
|
|
149
|
+
*
|
|
150
|
+
* Update the user email by its unique ID.
|
|
151
|
+
*
|
|
152
|
+
* @param {string} userId
|
|
153
|
+
* @param {string} email
|
|
154
|
+
* @throws {AppwriteException}
|
|
155
|
+
* @returns {Promise}
|
|
156
|
+
*/
|
|
157
|
+
async updateEmail(userId, email) {
|
|
158
|
+
if (typeof userId === 'undefined') {
|
|
159
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (typeof email === 'undefined') {
|
|
163
|
+
throw new AppwriteException('Missing required parameter: "email"');
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
let path = '/users/{userId}/email'.replace('{userId}', userId);
|
|
167
|
+
let payload = {};
|
|
168
|
+
|
|
169
|
+
if (typeof email !== 'undefined') {
|
|
170
|
+
payload['email'] = email;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return await this.client.call('patch', path, {
|
|
174
|
+
'content-type': 'application/json',
|
|
175
|
+
}, payload);
|
|
176
|
+
}
|
|
177
|
+
|
|
128
178
|
/**
|
|
129
179
|
* Get User Logs
|
|
130
180
|
*
|
|
131
|
-
* Get
|
|
181
|
+
* Get the user activity logs list by its unique ID.
|
|
132
182
|
*
|
|
133
183
|
* @param {string} userId
|
|
184
|
+
* @param {number} limit
|
|
185
|
+
* @param {number} offset
|
|
134
186
|
* @throws {AppwriteException}
|
|
135
187
|
* @returns {Promise}
|
|
136
188
|
*/
|
|
137
|
-
async getLogs(userId) {
|
|
189
|
+
async getLogs(userId, limit, offset) {
|
|
138
190
|
if (typeof userId === 'undefined') {
|
|
139
191
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
140
192
|
}
|
|
@@ -142,11 +194,81 @@ class Users extends Service {
|
|
|
142
194
|
let path = '/users/{userId}/logs'.replace('{userId}', userId);
|
|
143
195
|
let payload = {};
|
|
144
196
|
|
|
197
|
+
if (typeof limit !== 'undefined') {
|
|
198
|
+
payload['limit'] = limit;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (typeof offset !== 'undefined') {
|
|
202
|
+
payload['offset'] = offset;
|
|
203
|
+
}
|
|
204
|
+
|
|
145
205
|
return await this.client.call('get', path, {
|
|
146
206
|
'content-type': 'application/json',
|
|
147
207
|
}, payload);
|
|
148
208
|
}
|
|
149
209
|
|
|
210
|
+
/**
|
|
211
|
+
* Update Name
|
|
212
|
+
*
|
|
213
|
+
* Update the user name by its unique ID.
|
|
214
|
+
*
|
|
215
|
+
* @param {string} userId
|
|
216
|
+
* @param {string} name
|
|
217
|
+
* @throws {AppwriteException}
|
|
218
|
+
* @returns {Promise}
|
|
219
|
+
*/
|
|
220
|
+
async updateName(userId, name) {
|
|
221
|
+
if (typeof userId === 'undefined') {
|
|
222
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (typeof name === 'undefined') {
|
|
226
|
+
throw new AppwriteException('Missing required parameter: "name"');
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
let path = '/users/{userId}/name'.replace('{userId}', userId);
|
|
230
|
+
let payload = {};
|
|
231
|
+
|
|
232
|
+
if (typeof name !== 'undefined') {
|
|
233
|
+
payload['name'] = name;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return await this.client.call('patch', path, {
|
|
237
|
+
'content-type': 'application/json',
|
|
238
|
+
}, payload);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Update Password
|
|
243
|
+
*
|
|
244
|
+
* Update the user password by its unique ID.
|
|
245
|
+
*
|
|
246
|
+
* @param {string} userId
|
|
247
|
+
* @param {string} password
|
|
248
|
+
* @throws {AppwriteException}
|
|
249
|
+
* @returns {Promise}
|
|
250
|
+
*/
|
|
251
|
+
async updatePassword(userId, password) {
|
|
252
|
+
if (typeof userId === 'undefined') {
|
|
253
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (typeof password === 'undefined') {
|
|
257
|
+
throw new AppwriteException('Missing required parameter: "password"');
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
let path = '/users/{userId}/password'.replace('{userId}', userId);
|
|
261
|
+
let payload = {};
|
|
262
|
+
|
|
263
|
+
if (typeof password !== 'undefined') {
|
|
264
|
+
payload['password'] = password;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
return await this.client.call('patch', path, {
|
|
268
|
+
'content-type': 'application/json',
|
|
269
|
+
}, payload);
|
|
270
|
+
}
|
|
271
|
+
|
|
150
272
|
/**
|
|
151
273
|
* Get User Preferences
|
|
152
274
|
*
|
|
@@ -278,7 +400,7 @@ class Users extends Service {
|
|
|
278
400
|
* Update the user status by its unique ID.
|
|
279
401
|
*
|
|
280
402
|
* @param {string} userId
|
|
281
|
-
* @param {
|
|
403
|
+
* @param {boolean} status
|
|
282
404
|
* @throws {AppwriteException}
|
|
283
405
|
* @returns {Promise}
|
|
284
406
|
*/
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "node-appwrite",
|
|
3
3
|
"homepage": "https://appwrite.io/support",
|
|
4
4
|
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "4.0.0",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"types": "./index.d.ts",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"axios": "^0.
|
|
15
|
+
"axios": "^0.24.0",
|
|
16
16
|
"form-data": "^4.0.0"
|
|
17
17
|
}
|
|
18
18
|
}
|