node-appwrite 8.2.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.
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/docs/examples/account/create-phone-verification.md +1 -1
- package/docs/examples/account/create-recovery.md +1 -1
- package/docs/examples/account/create-verification.md +1 -1
- package/docs/examples/account/delete-identity.md +20 -0
- package/docs/examples/account/delete-session.md +1 -1
- package/docs/examples/account/delete-sessions.md +1 -1
- package/docs/examples/account/get-prefs.md +1 -1
- package/docs/examples/account/get-session.md +1 -1
- package/docs/examples/account/get.md +1 -1
- package/docs/examples/account/list-identities.md +20 -0
- package/docs/examples/account/list-logs.md +1 -1
- package/docs/examples/account/list-sessions.md +1 -1
- package/docs/examples/account/update-email.md +1 -1
- package/docs/examples/account/update-name.md +1 -1
- package/docs/examples/account/update-password.md +2 -2
- package/docs/examples/account/update-phone-verification.md +1 -1
- package/docs/examples/account/update-phone.md +1 -1
- package/docs/examples/account/update-prefs.md +1 -1
- package/docs/examples/account/update-recovery.md +1 -1
- package/docs/examples/account/update-session.md +1 -1
- package/docs/examples/account/update-status.md +1 -1
- package/docs/examples/account/update-verification.md +1 -1
- package/docs/examples/avatars/get-browser.md +1 -1
- package/docs/examples/avatars/get-credit-card.md +1 -1
- package/docs/examples/avatars/get-favicon.md +1 -1
- package/docs/examples/avatars/get-flag.md +1 -1
- package/docs/examples/avatars/get-image.md +1 -1
- package/docs/examples/avatars/get-initials.md +1 -1
- package/docs/examples/avatars/get-q-r.md +1 -1
- package/docs/examples/databases/create-boolean-attribute.md +1 -1
- package/docs/examples/databases/create-collection.md +1 -1
- package/docs/examples/databases/create-datetime-attribute.md +1 -1
- package/docs/examples/databases/create-document.md +1 -1
- package/docs/examples/databases/create-email-attribute.md +1 -1
- package/docs/examples/databases/create-enum-attribute.md +1 -1
- package/docs/examples/databases/create-float-attribute.md +1 -1
- package/docs/examples/databases/create-index.md +1 -1
- package/docs/examples/databases/create-integer-attribute.md +1 -1
- package/docs/examples/databases/create-ip-attribute.md +1 -1
- package/docs/examples/databases/create-relationship-attribute.md +20 -0
- package/docs/examples/databases/create-string-attribute.md +1 -1
- package/docs/examples/databases/create-url-attribute.md +1 -1
- package/docs/examples/databases/create.md +1 -1
- package/docs/examples/databases/delete-attribute.md +1 -1
- package/docs/examples/databases/delete-collection.md +1 -1
- package/docs/examples/databases/delete-document.md +1 -1
- package/docs/examples/databases/delete-index.md +1 -1
- package/docs/examples/databases/delete.md +1 -1
- package/docs/examples/databases/get-attribute.md +1 -1
- package/docs/examples/databases/get-collection.md +1 -1
- package/docs/examples/databases/get-document.md +1 -1
- package/docs/examples/databases/get-index.md +1 -1
- package/docs/examples/databases/get.md +1 -1
- package/docs/examples/databases/list-attributes.md +1 -1
- package/docs/examples/databases/list-collections.md +1 -1
- package/docs/examples/databases/list-documents.md +1 -1
- package/docs/examples/databases/list-indexes.md +1 -1
- package/docs/examples/databases/list.md +1 -1
- package/docs/examples/databases/update-boolean-attribute.md +20 -0
- package/docs/examples/databases/update-collection.md +1 -1
- package/docs/examples/databases/update-datetime-attribute.md +20 -0
- package/docs/examples/databases/update-document.md +1 -1
- package/docs/examples/databases/update-email-attribute.md +20 -0
- package/docs/examples/databases/update-enum-attribute.md +20 -0
- package/docs/examples/databases/update-float-attribute.md +20 -0
- package/docs/examples/databases/update-integer-attribute.md +20 -0
- package/docs/examples/databases/update-ip-attribute.md +20 -0
- package/docs/examples/databases/update-relationship-attribute.md +20 -0
- package/docs/examples/databases/update-string-attribute.md +20 -0
- package/docs/examples/databases/update-url-attribute.md +20 -0
- package/docs/examples/databases/update.md +1 -1
- package/docs/examples/functions/create-build.md +1 -1
- package/docs/examples/functions/create-deployment.md +2 -2
- package/docs/examples/functions/create-execution.md +1 -1
- package/docs/examples/functions/create-variable.md +1 -1
- package/docs/examples/functions/create.md +2 -2
- package/docs/examples/functions/delete-deployment.md +1 -1
- package/docs/examples/functions/delete-variable.md +1 -1
- package/docs/examples/functions/delete.md +1 -1
- package/docs/examples/functions/download-deployment.md +20 -0
- package/docs/examples/functions/get-deployment.md +1 -1
- package/docs/examples/functions/get-execution.md +1 -1
- package/docs/examples/functions/get-variable.md +1 -1
- package/docs/examples/functions/get.md +1 -1
- package/docs/examples/functions/list-deployments.md +1 -1
- package/docs/examples/functions/list-executions.md +1 -1
- package/docs/examples/functions/list-runtimes.md +1 -1
- package/docs/examples/functions/list-variables.md +1 -1
- package/docs/examples/functions/list.md +1 -1
- package/docs/examples/functions/update-deployment.md +1 -1
- package/docs/examples/functions/update-variable.md +1 -1
- package/docs/examples/functions/update.md +2 -2
- package/docs/examples/graphql/mutation.md +1 -1
- package/docs/examples/graphql/query.md +1 -1
- package/docs/examples/health/get-antivirus.md +1 -1
- package/docs/examples/health/get-cache.md +1 -1
- package/docs/examples/health/get-d-b.md +1 -1
- package/docs/examples/health/get-pub-sub.md +20 -0
- package/docs/examples/health/get-queue-certificates.md +1 -1
- package/docs/examples/health/get-queue-functions.md +1 -1
- package/docs/examples/health/get-queue-logs.md +1 -1
- package/docs/examples/health/get-queue-webhooks.md +1 -1
- package/docs/examples/health/get-queue.md +20 -0
- package/docs/examples/health/get-storage-local.md +1 -1
- package/docs/examples/health/get-time.md +1 -1
- package/docs/examples/health/get.md +1 -1
- package/docs/examples/locale/get.md +1 -1
- package/docs/examples/locale/list-codes.md +20 -0
- package/docs/examples/locale/list-continents.md +1 -1
- package/docs/examples/locale/list-countries-e-u.md +1 -1
- package/docs/examples/locale/list-countries-phones.md +1 -1
- package/docs/examples/locale/list-countries.md +1 -1
- package/docs/examples/locale/list-currencies.md +1 -1
- package/docs/examples/locale/list-languages.md +1 -1
- package/docs/examples/storage/create-bucket.md +1 -1
- package/docs/examples/storage/create-file.md +1 -1
- package/docs/examples/storage/delete-bucket.md +1 -1
- package/docs/examples/storage/delete-file.md +1 -1
- package/docs/examples/storage/get-bucket.md +1 -1
- package/docs/examples/storage/get-file-download.md +1 -1
- package/docs/examples/storage/get-file-preview.md +1 -1
- package/docs/examples/storage/get-file-view.md +1 -1
- package/docs/examples/storage/get-file.md +1 -1
- package/docs/examples/storage/list-buckets.md +1 -1
- package/docs/examples/storage/list-files.md +1 -1
- package/docs/examples/storage/update-bucket.md +1 -1
- package/docs/examples/storage/update-file.md +1 -1
- package/docs/examples/teams/create-membership.md +2 -2
- package/docs/examples/teams/create.md +1 -1
- package/docs/examples/teams/delete-membership.md +1 -1
- package/docs/examples/teams/delete.md +1 -1
- package/docs/examples/teams/get-membership.md +1 -1
- package/docs/examples/teams/get-prefs.md +20 -0
- package/docs/examples/teams/get.md +1 -1
- package/docs/examples/teams/list-memberships.md +1 -1
- package/docs/examples/teams/list.md +1 -1
- package/docs/examples/teams/update-membership-status.md +1 -1
- package/docs/examples/teams/{update-membership-roles.md → update-membership.md} +2 -2
- package/docs/examples/teams/{update.md → update-name.md} +2 -2
- package/docs/examples/teams/update-prefs.md +20 -0
- package/docs/examples/users/create-argon2user.md +1 -1
- package/docs/examples/users/create-bcrypt-user.md +1 -1
- package/docs/examples/users/create-m-d5user.md +1 -1
- package/docs/examples/users/create-p-h-pass-user.md +1 -1
- package/docs/examples/users/create-s-h-a-user.md +1 -1
- package/docs/examples/users/create-scrypt-modified-user.md +1 -1
- package/docs/examples/users/create-scrypt-user.md +1 -1
- package/docs/examples/users/create.md +1 -1
- package/docs/examples/users/delete-identity.md +20 -0
- package/docs/examples/users/delete-session.md +1 -1
- package/docs/examples/users/delete-sessions.md +1 -1
- package/docs/examples/users/delete.md +1 -1
- package/docs/examples/users/get-prefs.md +1 -1
- package/docs/examples/users/get.md +1 -1
- package/docs/examples/users/list-identities.md +20 -0
- package/docs/examples/users/list-logs.md +1 -1
- package/docs/examples/users/list-memberships.md +1 -1
- package/docs/examples/users/list-sessions.md +1 -1
- package/docs/examples/users/list.md +1 -1
- package/docs/examples/users/update-email-verification.md +1 -1
- package/docs/examples/users/update-email.md +1 -1
- package/docs/examples/users/update-labels.md +20 -0
- package/docs/examples/users/update-name.md +1 -1
- package/docs/examples/users/update-password.md +2 -2
- package/docs/examples/users/update-phone-verification.md +1 -1
- package/docs/examples/users/update-phone.md +1 -1
- package/docs/examples/users/update-prefs.md +1 -1
- package/docs/examples/users/update-status.md +1 -1
- package/index.d.ts +767 -165
- package/lib/client.js +5 -2
- package/lib/inputFile.js +6 -8
- package/lib/query.js +18 -0
- package/lib/services/account.js +94 -50
- package/lib/services/avatars.js +14 -14
- package/lib/services/databases.js +826 -180
- package/lib/services/functions.js +254 -101
- package/lib/services/graphql.js +4 -4
- package/lib/services/health.js +57 -22
- package/lib/services/locale.js +32 -14
- package/lib/services/storage.js +76 -63
- package/lib/services/teams.js +112 -43
- package/lib/services/users.js +135 -50
- package/package.json +6 -4
package/lib/services/teams.js
CHANGED
|
@@ -26,7 +26,7 @@ class Teams extends Service {
|
|
|
26
26
|
* @returns {Promise}
|
|
27
27
|
*/
|
|
28
28
|
async list(queries, search) {
|
|
29
|
-
|
|
29
|
+
const apiPath = '/teams';
|
|
30
30
|
let payload = {};
|
|
31
31
|
|
|
32
32
|
if (typeof queries !== 'undefined') {
|
|
@@ -37,7 +37,7 @@ class Teams extends Service {
|
|
|
37
37
|
payload['search'] = search;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
return await this.client.call('get',
|
|
40
|
+
return await this.client.call('get', apiPath, {
|
|
41
41
|
'content-type': 'application/json',
|
|
42
42
|
}, payload);
|
|
43
43
|
}
|
|
@@ -56,7 +56,7 @@ class Teams extends Service {
|
|
|
56
56
|
* @returns {Promise}
|
|
57
57
|
*/
|
|
58
58
|
async create(teamId, name, roles) {
|
|
59
|
-
|
|
59
|
+
const apiPath = '/teams';
|
|
60
60
|
let payload = {};
|
|
61
61
|
if (typeof teamId === 'undefined') {
|
|
62
62
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
@@ -79,7 +79,7 @@ class Teams extends Service {
|
|
|
79
79
|
payload['roles'] = roles;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
return await this.client.call('post',
|
|
82
|
+
return await this.client.call('post', apiPath, {
|
|
83
83
|
'content-type': 'application/json',
|
|
84
84
|
}, payload);
|
|
85
85
|
}
|
|
@@ -94,31 +94,30 @@ class Teams extends Service {
|
|
|
94
94
|
* @returns {Promise}
|
|
95
95
|
*/
|
|
96
96
|
async get(teamId) {
|
|
97
|
-
|
|
97
|
+
const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
|
|
98
98
|
let payload = {};
|
|
99
99
|
if (typeof teamId === 'undefined') {
|
|
100
100
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
|
|
104
|
-
return await this.client.call('get',
|
|
104
|
+
return await this.client.call('get', apiPath, {
|
|
105
105
|
'content-type': 'application/json',
|
|
106
106
|
}, payload);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
|
-
* Update
|
|
110
|
+
* Update Name
|
|
111
111
|
*
|
|
112
|
-
* Update
|
|
113
|
-
* team.
|
|
112
|
+
* Update the team's name by its unique ID.
|
|
114
113
|
*
|
|
115
114
|
* @param {string} teamId
|
|
116
115
|
* @param {string} name
|
|
117
116
|
* @throws {AppwriteException}
|
|
118
117
|
* @returns {Promise}
|
|
119
118
|
*/
|
|
120
|
-
async
|
|
121
|
-
|
|
119
|
+
async updateName(teamId, name) {
|
|
120
|
+
const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
|
|
122
121
|
let payload = {};
|
|
123
122
|
if (typeof teamId === 'undefined') {
|
|
124
123
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
@@ -133,7 +132,7 @@ class Teams extends Service {
|
|
|
133
132
|
payload['name'] = name;
|
|
134
133
|
}
|
|
135
134
|
|
|
136
|
-
return await this.client.call('put',
|
|
135
|
+
return await this.client.call('put', apiPath, {
|
|
137
136
|
'content-type': 'application/json',
|
|
138
137
|
}, payload);
|
|
139
138
|
}
|
|
@@ -149,14 +148,14 @@ class Teams extends Service {
|
|
|
149
148
|
* @returns {Promise}
|
|
150
149
|
*/
|
|
151
150
|
async delete(teamId) {
|
|
152
|
-
|
|
151
|
+
const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
|
|
153
152
|
let payload = {};
|
|
154
153
|
if (typeof teamId === 'undefined') {
|
|
155
154
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
156
155
|
}
|
|
157
156
|
|
|
158
157
|
|
|
159
|
-
return await this.client.call('delete',
|
|
158
|
+
return await this.client.call('delete', apiPath, {
|
|
160
159
|
'content-type': 'application/json',
|
|
161
160
|
}, payload);
|
|
162
161
|
}
|
|
@@ -174,7 +173,7 @@ class Teams extends Service {
|
|
|
174
173
|
* @returns {Promise}
|
|
175
174
|
*/
|
|
176
175
|
async listMemberships(teamId, queries, search) {
|
|
177
|
-
|
|
176
|
+
const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
|
|
178
177
|
let payload = {};
|
|
179
178
|
if (typeof teamId === 'undefined') {
|
|
180
179
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
@@ -189,7 +188,7 @@ class Teams extends Service {
|
|
|
189
188
|
payload['search'] = search;
|
|
190
189
|
}
|
|
191
190
|
|
|
192
|
-
return await this.client.call('get',
|
|
191
|
+
return await this.client.call('get', apiPath, {
|
|
193
192
|
'content-type': 'application/json',
|
|
194
193
|
}, payload);
|
|
195
194
|
}
|
|
@@ -197,41 +196,45 @@ class Teams extends Service {
|
|
|
197
196
|
/**
|
|
198
197
|
* Create Team Membership
|
|
199
198
|
*
|
|
200
|
-
* Invite a new member to join your team.
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
199
|
+
* Invite a new member to join your team. Provide an ID for existing users, or
|
|
200
|
+
* invite unregistered users using an email or phone number. If initiated from
|
|
201
|
+
* a Client SDK, Appwrite will send an email or sms with a link to join the
|
|
202
|
+
* team to the invited user, and an account will be created for them if one
|
|
203
|
+
* doesn't exist. If initiated from a Server SDK, the new member will be added
|
|
204
|
+
* automatically to the team.
|
|
205
205
|
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
206
|
+
* You only need to provide one of a user ID, email, or phone number. Appwrite
|
|
207
|
+
* will prioritize accepting the user ID > email > phone number if you provide
|
|
208
|
+
* more than one of these parameters.
|
|
209
|
+
*
|
|
210
|
+
* Use the `url` parameter to redirect the user from the invitation email to
|
|
211
|
+
* your app. After the user is redirected, use the [Update Team Membership
|
|
208
212
|
* Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow
|
|
209
213
|
* the user to accept the invitation to the team.
|
|
210
214
|
*
|
|
211
215
|
* Please note that to avoid a [Redirect
|
|
212
216
|
* Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
|
213
|
-
* the only
|
|
214
|
-
*
|
|
217
|
+
* Appwrite will accept the only redirect URLs under the domains you have
|
|
218
|
+
* added as a platform on the Appwrite Console.
|
|
219
|
+
*
|
|
215
220
|
*
|
|
216
221
|
* @param {string} teamId
|
|
217
|
-
* @param {string} email
|
|
218
222
|
* @param {string[]} roles
|
|
219
223
|
* @param {string} url
|
|
224
|
+
* @param {string} email
|
|
225
|
+
* @param {string} userId
|
|
226
|
+
* @param {string} phone
|
|
220
227
|
* @param {string} name
|
|
221
228
|
* @throws {AppwriteException}
|
|
222
229
|
* @returns {Promise}
|
|
223
230
|
*/
|
|
224
|
-
async createMembership(teamId, email,
|
|
225
|
-
|
|
231
|
+
async createMembership(teamId, roles, url, email, userId, phone, name) {
|
|
232
|
+
const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
|
|
226
233
|
let payload = {};
|
|
227
234
|
if (typeof teamId === 'undefined') {
|
|
228
235
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
229
236
|
}
|
|
230
237
|
|
|
231
|
-
if (typeof email === 'undefined') {
|
|
232
|
-
throw new AppwriteException('Missing required parameter: "email"');
|
|
233
|
-
}
|
|
234
|
-
|
|
235
238
|
if (typeof roles === 'undefined') {
|
|
236
239
|
throw new AppwriteException('Missing required parameter: "roles"');
|
|
237
240
|
}
|
|
@@ -245,6 +248,14 @@ class Teams extends Service {
|
|
|
245
248
|
payload['email'] = email;
|
|
246
249
|
}
|
|
247
250
|
|
|
251
|
+
if (typeof userId !== 'undefined') {
|
|
252
|
+
payload['userId'] = userId;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if (typeof phone !== 'undefined') {
|
|
256
|
+
payload['phone'] = phone;
|
|
257
|
+
}
|
|
258
|
+
|
|
248
259
|
if (typeof roles !== 'undefined') {
|
|
249
260
|
payload['roles'] = roles;
|
|
250
261
|
}
|
|
@@ -257,7 +268,7 @@ class Teams extends Service {
|
|
|
257
268
|
payload['name'] = name;
|
|
258
269
|
}
|
|
259
270
|
|
|
260
|
-
return await this.client.call('post',
|
|
271
|
+
return await this.client.call('post', apiPath, {
|
|
261
272
|
'content-type': 'application/json',
|
|
262
273
|
}, payload);
|
|
263
274
|
}
|
|
@@ -274,7 +285,7 @@ class Teams extends Service {
|
|
|
274
285
|
* @returns {Promise}
|
|
275
286
|
*/
|
|
276
287
|
async getMembership(teamId, membershipId) {
|
|
277
|
-
|
|
288
|
+
const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
|
|
278
289
|
let payload = {};
|
|
279
290
|
if (typeof teamId === 'undefined') {
|
|
280
291
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
@@ -285,17 +296,18 @@ class Teams extends Service {
|
|
|
285
296
|
}
|
|
286
297
|
|
|
287
298
|
|
|
288
|
-
return await this.client.call('get',
|
|
299
|
+
return await this.client.call('get', apiPath, {
|
|
289
300
|
'content-type': 'application/json',
|
|
290
301
|
}, payload);
|
|
291
302
|
}
|
|
292
303
|
|
|
293
304
|
/**
|
|
294
|
-
* Update Membership
|
|
305
|
+
* Update Membership
|
|
295
306
|
*
|
|
296
307
|
* Modify the roles of a team member. Only team members with the owner role
|
|
297
308
|
* have access to this endpoint. Learn more about [roles and
|
|
298
309
|
* permissions](/docs/permissions).
|
|
310
|
+
*
|
|
299
311
|
*
|
|
300
312
|
* @param {string} teamId
|
|
301
313
|
* @param {string} membershipId
|
|
@@ -303,8 +315,8 @@ class Teams extends Service {
|
|
|
303
315
|
* @throws {AppwriteException}
|
|
304
316
|
* @returns {Promise}
|
|
305
317
|
*/
|
|
306
|
-
async
|
|
307
|
-
|
|
318
|
+
async updateMembership(teamId, membershipId, roles) {
|
|
319
|
+
const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
|
|
308
320
|
let payload = {};
|
|
309
321
|
if (typeof teamId === 'undefined') {
|
|
310
322
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
@@ -323,7 +335,7 @@ class Teams extends Service {
|
|
|
323
335
|
payload['roles'] = roles;
|
|
324
336
|
}
|
|
325
337
|
|
|
326
|
-
return await this.client.call('patch',
|
|
338
|
+
return await this.client.call('patch', apiPath, {
|
|
327
339
|
'content-type': 'application/json',
|
|
328
340
|
}, payload);
|
|
329
341
|
}
|
|
@@ -341,7 +353,7 @@ class Teams extends Service {
|
|
|
341
353
|
* @returns {Promise}
|
|
342
354
|
*/
|
|
343
355
|
async deleteMembership(teamId, membershipId) {
|
|
344
|
-
|
|
356
|
+
const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
|
|
345
357
|
let payload = {};
|
|
346
358
|
if (typeof teamId === 'undefined') {
|
|
347
359
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
@@ -352,7 +364,7 @@ class Teams extends Service {
|
|
|
352
364
|
}
|
|
353
365
|
|
|
354
366
|
|
|
355
|
-
return await this.client.call('delete',
|
|
367
|
+
return await this.client.call('delete', apiPath, {
|
|
356
368
|
'content-type': 'application/json',
|
|
357
369
|
}, payload);
|
|
358
370
|
}
|
|
@@ -376,7 +388,7 @@ class Teams extends Service {
|
|
|
376
388
|
* @returns {Promise}
|
|
377
389
|
*/
|
|
378
390
|
async updateMembershipStatus(teamId, membershipId, userId, secret) {
|
|
379
|
-
|
|
391
|
+
const apiPath = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
|
|
380
392
|
let payload = {};
|
|
381
393
|
if (typeof teamId === 'undefined') {
|
|
382
394
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
@@ -403,7 +415,64 @@ class Teams extends Service {
|
|
|
403
415
|
payload['secret'] = secret;
|
|
404
416
|
}
|
|
405
417
|
|
|
406
|
-
return await this.client.call('patch',
|
|
418
|
+
return await this.client.call('patch', apiPath, {
|
|
419
|
+
'content-type': 'application/json',
|
|
420
|
+
}, payload);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Get Team Preferences
|
|
425
|
+
*
|
|
426
|
+
* Get the team's shared preferences by its unique ID. If a preference doesn't
|
|
427
|
+
* need to be shared by all team members, prefer storing them in [user
|
|
428
|
+
* preferences](/docs/client/account#accountGetPrefs).
|
|
429
|
+
*
|
|
430
|
+
* @param {string} teamId
|
|
431
|
+
* @throws {AppwriteException}
|
|
432
|
+
* @returns {Promise}
|
|
433
|
+
*/
|
|
434
|
+
async getPrefs(teamId) {
|
|
435
|
+
const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
|
|
436
|
+
let payload = {};
|
|
437
|
+
if (typeof teamId === 'undefined') {
|
|
438
|
+
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
return await this.client.call('get', apiPath, {
|
|
443
|
+
'content-type': 'application/json',
|
|
444
|
+
}, payload);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Update Preferences
|
|
449
|
+
*
|
|
450
|
+
* Update the team's preferences by its unique ID. The object you pass is
|
|
451
|
+
* stored as is and replaces any previous value. The maximum allowed prefs
|
|
452
|
+
* size is 64kB and throws an error if exceeded.
|
|
453
|
+
*
|
|
454
|
+
* @param {string} teamId
|
|
455
|
+
* @param {object} prefs
|
|
456
|
+
* @throws {AppwriteException}
|
|
457
|
+
* @returns {Promise}
|
|
458
|
+
*/
|
|
459
|
+
async updatePrefs(teamId, prefs) {
|
|
460
|
+
const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
|
|
461
|
+
let payload = {};
|
|
462
|
+
if (typeof teamId === 'undefined') {
|
|
463
|
+
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
if (typeof prefs === 'undefined') {
|
|
467
|
+
throw new AppwriteException('Missing required parameter: "prefs"');
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
if (typeof prefs !== 'undefined') {
|
|
472
|
+
payload['prefs'] = prefs;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
return await this.client.call('put', apiPath, {
|
|
407
476
|
'content-type': 'application/json',
|
|
408
477
|
}, payload);
|
|
409
478
|
}
|