@appwrite.io/console 0.6.0-rc.5 → 0.6.0-rc.6

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/dist/iife/sdk.js CHANGED
@@ -102,7 +102,7 @@
102
102
  'x-sdk-name': 'Console',
103
103
  'x-sdk-platform': 'console',
104
104
  'x-sdk-language': 'web',
105
- 'x-sdk-version': '0.6.0-rc.5',
105
+ 'x-sdk-version': '0.6.0-rc.6',
106
106
  'X-Appwrite-Response-Format': '1.4.0',
107
107
  };
108
108
  this.realtime = {
@@ -11069,6 +11069,66 @@
11069
11069
  }, payload);
11070
11070
  });
11071
11071
  }
11072
+ /**
11073
+ * Update MFA
11074
+ *
11075
+ *
11076
+ * @param {string} userId
11077
+ * @param {boolean} mfa
11078
+ * @throws {AppwriteException}
11079
+ * @returns {Promise}
11080
+ */
11081
+ updateMfa(userId, mfa) {
11082
+ return __awaiter(this, void 0, void 0, function* () {
11083
+ if (typeof userId === 'undefined') {
11084
+ throw new AppwriteException('Missing required parameter: "userId"');
11085
+ }
11086
+ if (typeof mfa === 'undefined') {
11087
+ throw new AppwriteException('Missing required parameter: "mfa"');
11088
+ }
11089
+ const apiPath = '/users/{userId}/mfa'.replace('{userId}', userId);
11090
+ const payload = {};
11091
+ if (typeof mfa !== 'undefined') {
11092
+ payload['mfa'] = mfa;
11093
+ }
11094
+ const uri = new URL(this.client.config.endpoint + apiPath);
11095
+ return yield this.client.call('patch', uri, {
11096
+ 'content-type': 'application/json',
11097
+ }, payload);
11098
+ });
11099
+ }
11100
+ /**
11101
+ * Delete Authenticator
11102
+ *
11103
+ *
11104
+ * @param {string} userId
11105
+ * @param {string} provider
11106
+ * @param {string} otp
11107
+ * @throws {AppwriteException}
11108
+ * @returns {Promise}
11109
+ */
11110
+ deleteAuthenticator(userId, provider, otp) {
11111
+ return __awaiter(this, void 0, void 0, function* () {
11112
+ if (typeof userId === 'undefined') {
11113
+ throw new AppwriteException('Missing required parameter: "userId"');
11114
+ }
11115
+ if (typeof provider === 'undefined') {
11116
+ throw new AppwriteException('Missing required parameter: "provider"');
11117
+ }
11118
+ if (typeof otp === 'undefined') {
11119
+ throw new AppwriteException('Missing required parameter: "otp"');
11120
+ }
11121
+ const apiPath = '/users/{userId}/mfa/{provider}'.replace('{userId}', userId).replace('{provider}', provider);
11122
+ const payload = {};
11123
+ if (typeof otp !== 'undefined') {
11124
+ payload['otp'] = otp;
11125
+ }
11126
+ const uri = new URL(this.client.config.endpoint + apiPath);
11127
+ return yield this.client.call('delete', uri, {
11128
+ 'content-type': 'application/json',
11129
+ }, payload);
11130
+ });
11131
+ }
11072
11132
  /**
11073
11133
  * Update name
11074
11134
  *
@@ -11209,6 +11269,27 @@
11209
11269
  }, payload);
11210
11270
  });
11211
11271
  }
11272
+ /**
11273
+ * List Providers
11274
+ *
11275
+ *
11276
+ * @param {string} userId
11277
+ * @throws {AppwriteException}
11278
+ * @returns {Promise}
11279
+ */
11280
+ listProviders(userId) {
11281
+ return __awaiter(this, void 0, void 0, function* () {
11282
+ if (typeof userId === 'undefined') {
11283
+ throw new AppwriteException('Missing required parameter: "userId"');
11284
+ }
11285
+ const apiPath = '/users/{userId}/providers'.replace('{userId}', userId);
11286
+ const payload = {};
11287
+ const uri = new URL(this.client.config.endpoint + apiPath);
11288
+ return yield this.client.call('get', uri, {
11289
+ 'content-type': 'application/json',
11290
+ }, payload);
11291
+ });
11292
+ }
11212
11293
  /**
11213
11294
  * List user sessions
11214
11295
  *
@@ -0,0 +1,18 @@
1
+ import { Client, Users } from "@appwrite.io/console";
2
+
3
+ const client = new Client();
4
+
5
+ const users = new Users(client);
6
+
7
+ client
8
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
+ .setProject('5df5acd0d48c2') // Your project ID
10
+ ;
11
+
12
+ const promise = users.deleteAuthenticator('[USER_ID]', 'totp', '[OTP]');
13
+
14
+ promise.then(function (response) {
15
+ console.log(response); // Success
16
+ }, function (error) {
17
+ console.log(error); // Failure
18
+ });
@@ -0,0 +1,18 @@
1
+ import { Client, Users } from "@appwrite.io/console";
2
+
3
+ const client = new Client();
4
+
5
+ const users = new Users(client);
6
+
7
+ client
8
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
+ .setProject('5df5acd0d48c2') // Your project ID
10
+ ;
11
+
12
+ const promise = users.listProviders('[USER_ID]');
13
+
14
+ promise.then(function (response) {
15
+ console.log(response); // Success
16
+ }, function (error) {
17
+ console.log(error); // Failure
18
+ });
@@ -0,0 +1,18 @@
1
+ import { Client, Users } from "@appwrite.io/console";
2
+
3
+ const client = new Client();
4
+
5
+ const users = new Users(client);
6
+
7
+ client
8
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
+ .setProject('5df5acd0d48c2') // Your project ID
10
+ ;
11
+
12
+ const promise = users.updateMfa('[USER_ID]', false);
13
+
14
+ promise.then(function (response) {
15
+ console.log(response); // Success
16
+ }, function (error) {
17
+ console.log(error); // Failure
18
+ });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@appwrite.io/console",
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": "0.6.0-rc.5",
5
+ "version": "0.6.0-rc.6",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "dist/cjs/sdk.js",
8
8
  "exports": {
package/src/client.ts CHANGED
@@ -104,7 +104,7 @@ class Client {
104
104
  'x-sdk-name': 'Console',
105
105
  'x-sdk-platform': 'console',
106
106
  'x-sdk-language': 'web',
107
- 'x-sdk-version': '0.6.0-rc.5',
107
+ 'x-sdk-version': '0.6.0-rc.6',
108
108
  'X-Appwrite-Response-Format': '1.4.0',
109
109
  };
110
110
 
@@ -784,6 +784,73 @@ export class Users extends Service {
784
784
  }, payload);
785
785
  }
786
786
 
787
+ /**
788
+ * Update MFA
789
+ *
790
+ *
791
+ * @param {string} userId
792
+ * @param {boolean} mfa
793
+ * @throws {AppwriteException}
794
+ * @returns {Promise}
795
+ */
796
+ async updateMfa<Preferences extends Models.Preferences>(userId: string, mfa: boolean): Promise<Models.User<Preferences>> {
797
+ if (typeof userId === 'undefined') {
798
+ throw new AppwriteException('Missing required parameter: "userId"');
799
+ }
800
+
801
+ if (typeof mfa === 'undefined') {
802
+ throw new AppwriteException('Missing required parameter: "mfa"');
803
+ }
804
+
805
+ const apiPath = '/users/{userId}/mfa'.replace('{userId}', userId);
806
+ const payload: Payload = {};
807
+
808
+ if (typeof mfa !== 'undefined') {
809
+ payload['mfa'] = mfa;
810
+ }
811
+
812
+ const uri = new URL(this.client.config.endpoint + apiPath);
813
+ return await this.client.call('patch', uri, {
814
+ 'content-type': 'application/json',
815
+ }, payload);
816
+ }
817
+
818
+ /**
819
+ * Delete Authenticator
820
+ *
821
+ *
822
+ * @param {string} userId
823
+ * @param {string} provider
824
+ * @param {string} otp
825
+ * @throws {AppwriteException}
826
+ * @returns {Promise}
827
+ */
828
+ async deleteAuthenticator<Preferences extends Models.Preferences>(userId: string, provider: string, otp: string): Promise<Models.User<Preferences>> {
829
+ if (typeof userId === 'undefined') {
830
+ throw new AppwriteException('Missing required parameter: "userId"');
831
+ }
832
+
833
+ if (typeof provider === 'undefined') {
834
+ throw new AppwriteException('Missing required parameter: "provider"');
835
+ }
836
+
837
+ if (typeof otp === 'undefined') {
838
+ throw new AppwriteException('Missing required parameter: "otp"');
839
+ }
840
+
841
+ const apiPath = '/users/{userId}/mfa/{provider}'.replace('{userId}', userId).replace('{provider}', provider);
842
+ const payload: Payload = {};
843
+
844
+ if (typeof otp !== 'undefined') {
845
+ payload['otp'] = otp;
846
+ }
847
+
848
+ const uri = new URL(this.client.config.endpoint + apiPath);
849
+ return await this.client.call('delete', uri, {
850
+ 'content-type': 'application/json',
851
+ }, payload);
852
+ }
853
+
787
854
  /**
788
855
  * Update name
789
856
  *
@@ -937,6 +1004,28 @@ export class Users extends Service {
937
1004
  }, payload);
938
1005
  }
939
1006
 
1007
+ /**
1008
+ * List Providers
1009
+ *
1010
+ *
1011
+ * @param {string} userId
1012
+ * @throws {AppwriteException}
1013
+ * @returns {Promise}
1014
+ */
1015
+ async listProviders(userId: string): Promise<Models.MfaProviders> {
1016
+ if (typeof userId === 'undefined') {
1017
+ throw new AppwriteException('Missing required parameter: "userId"');
1018
+ }
1019
+
1020
+ const apiPath = '/users/{userId}/providers'.replace('{userId}', userId);
1021
+ const payload: Payload = {};
1022
+
1023
+ const uri = new URL(this.client.config.endpoint + apiPath);
1024
+ return await this.client.call('get', uri, {
1025
+ 'content-type': 'application/json',
1026
+ }, payload);
1027
+ }
1028
+
940
1029
  /**
941
1030
  * List user sessions
942
1031
  *
@@ -255,6 +255,27 @@ export declare class Users extends Service {
255
255
  * @returns {Promise}
256
256
  */
257
257
  listMemberships(userId: string): Promise<Models.MembershipList>;
258
+ /**
259
+ * Update MFA
260
+ *
261
+ *
262
+ * @param {string} userId
263
+ * @param {boolean} mfa
264
+ * @throws {AppwriteException}
265
+ * @returns {Promise}
266
+ */
267
+ updateMfa<Preferences extends Models.Preferences>(userId: string, mfa: boolean): Promise<Models.User<Preferences>>;
268
+ /**
269
+ * Delete Authenticator
270
+ *
271
+ *
272
+ * @param {string} userId
273
+ * @param {string} provider
274
+ * @param {string} otp
275
+ * @throws {AppwriteException}
276
+ * @returns {Promise}
277
+ */
278
+ deleteAuthenticator<Preferences extends Models.Preferences>(userId: string, provider: string, otp: string): Promise<Models.User<Preferences>>;
258
279
  /**
259
280
  * Update name
260
281
  *
@@ -311,6 +332,15 @@ export declare class Users extends Service {
311
332
  * @returns {Promise}
312
333
  */
313
334
  updatePrefs<Preferences extends Models.Preferences>(userId: string, prefs: object): Promise<Preferences>;
335
+ /**
336
+ * List Providers
337
+ *
338
+ *
339
+ * @param {string} userId
340
+ * @throws {AppwriteException}
341
+ * @returns {Promise}
342
+ */
343
+ listProviders(userId: string): Promise<Models.MfaProviders>;
314
344
  /**
315
345
  * List user sessions
316
346
  *