@appwrite.io/console 0.1.0 → 0.2.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/dist/esm/sdk.js CHANGED
@@ -55,6 +55,12 @@ Query.lessThan = (attribute, value) => Query.addQuery(attribute, "lessThan", val
55
55
  Query.lessThanEqual = (attribute, value) => Query.addQuery(attribute, "lessThanEqual", value);
56
56
  Query.greaterThan = (attribute, value) => Query.addQuery(attribute, "greaterThan", value);
57
57
  Query.greaterThanEqual = (attribute, value) => Query.addQuery(attribute, "greaterThanEqual", value);
58
+ Query.isNull = (attribute) => `isNull("${attribute}")`;
59
+ Query.isNotNull = (attribute) => `isNotNull("${attribute}")`;
60
+ Query.between = (attribute, start, end) => `between("${attribute}", [${Query.parseValues(start)},${Query.parseValues(end)}])`;
61
+ Query.startsWith = (attribute, value) => Query.addQuery(attribute, "startsWith", value);
62
+ Query.endsWith = (attribute, value) => Query.addQuery(attribute, "endsWith", value);
63
+ Query.select = (attributes) => `select([${attributes.map((attr) => `"${attr}"`).join(",")}])`;
58
64
  Query.search = (attribute, value) => Query.addQuery(attribute, "search", value);
59
65
  Query.orderDesc = (attribute) => `orderDesc("${attribute}")`;
60
66
  Query.orderAsc = (attribute) => `orderAsc("${attribute}")`;
@@ -96,7 +102,7 @@ class Client {
96
102
  'x-sdk-name': 'Console',
97
103
  'x-sdk-platform': 'console',
98
104
  'x-sdk-language': 'web',
99
- 'x-sdk-version': '0.1.0',
105
+ 'x-sdk-version': '0.2.0',
100
106
  'X-Appwrite-Response-Format': '1.0.0',
101
107
  };
102
108
  this.realtime = {
@@ -538,6 +544,58 @@ class Account extends Service {
538
544
  }, payload);
539
545
  });
540
546
  }
547
+ /**
548
+ * Create account using an invite code
549
+ *
550
+ * Use this endpoint to allow a new user to register a new account in your
551
+ * project. After the user registration completes successfully, you can use
552
+ * the [/account/verfication](/docs/client/account#accountCreateVerification)
553
+ * route to start verifying the user email address. To allow the new user to
554
+ * login to their new account, you need to create a new [account
555
+ * session](/docs/client/account#accountCreateSession).
556
+ *
557
+ * @param {string} userId
558
+ * @param {string} email
559
+ * @param {string} password
560
+ * @param {string} name
561
+ * @param {string} code
562
+ * @throws {AppwriteException}
563
+ * @returns {Promise}
564
+ */
565
+ createWithInviteCode(userId, email, password, name, code) {
566
+ return __awaiter(this, void 0, void 0, function* () {
567
+ if (typeof userId === 'undefined') {
568
+ throw new AppwriteException('Missing required parameter: "userId"');
569
+ }
570
+ if (typeof email === 'undefined') {
571
+ throw new AppwriteException('Missing required parameter: "email"');
572
+ }
573
+ if (typeof password === 'undefined') {
574
+ throw new AppwriteException('Missing required parameter: "password"');
575
+ }
576
+ let path = '/account/invite';
577
+ let payload = {};
578
+ if (typeof userId !== 'undefined') {
579
+ payload['userId'] = userId;
580
+ }
581
+ if (typeof email !== 'undefined') {
582
+ payload['email'] = email;
583
+ }
584
+ if (typeof password !== 'undefined') {
585
+ payload['password'] = password;
586
+ }
587
+ if (typeof name !== 'undefined') {
588
+ payload['name'] = name;
589
+ }
590
+ if (typeof code !== 'undefined') {
591
+ payload['code'] = code;
592
+ }
593
+ const uri = new URL(this.client.config.endpoint + path);
594
+ return yield this.client.call('post', uri, {
595
+ 'content-type': 'application/json',
596
+ }, payload);
597
+ });
598
+ }
541
599
  /**
542
600
  * Create JWT
543
601
  *
@@ -1646,6 +1704,30 @@ class Avatars extends Service {
1646
1704
  }
1647
1705
  }
1648
1706
 
1707
+ class Console extends Service {
1708
+ constructor(client) {
1709
+ super(client);
1710
+ }
1711
+ /**
1712
+ * Get Variables
1713
+ *
1714
+ * Get all Environment Variables that are relevant for the console.
1715
+ *
1716
+ * @throws {AppwriteException}
1717
+ * @returns {Promise}
1718
+ */
1719
+ variables() {
1720
+ return __awaiter(this, void 0, void 0, function* () {
1721
+ let path = '/console/variables';
1722
+ let payload = {};
1723
+ const uri = new URL(this.client.config.endpoint + path);
1724
+ return yield this.client.call('get', uri, {
1725
+ 'content-type': 'application/json',
1726
+ }, payload);
1727
+ });
1728
+ }
1729
+ }
1730
+
1649
1731
  class Databases extends Service {
1650
1732
  constructor(client) {
1651
1733
  super(client);
@@ -2727,7 +2809,7 @@ class Databases extends Service {
2727
2809
  * Create Relationship Attribute
2728
2810
  *
2729
2811
  * Create relationship attribute. [Learn more about relationship
2730
- * attributes](docs/databases-relationships#relationship-attributes).
2812
+ * attributes](/docs/databases-relationships#relationship-attributes).
2731
2813
  *
2732
2814
  *
2733
2815
  * @param {string} databaseId
@@ -3040,7 +3122,7 @@ class Databases extends Service {
3040
3122
  * Update Relationship Attribute
3041
3123
  *
3042
3124
  * Update relationship attribute. [Learn more about relationship
3043
- * attributes](docs/databases-relationships#relationship-attributes).
3125
+ * attributes](/docs/databases-relationships#relationship-attributes).
3044
3126
  *
3045
3127
  *
3046
3128
  * @param {string} databaseId
@@ -4352,7 +4434,7 @@ class Health extends Service {
4352
4434
  /**
4353
4435
  * Get Cache
4354
4436
  *
4355
- * Check the Appwrite in-memory cache server is up and connection is
4437
+ * Check the Appwrite in-memory cache servers are up and connection is
4356
4438
  * successful.
4357
4439
  *
4358
4440
  * @throws {AppwriteException}
@@ -4371,7 +4453,7 @@ class Health extends Service {
4371
4453
  /**
4372
4454
  * Get DB
4373
4455
  *
4374
- * Check the Appwrite database server is up and connection is successful.
4456
+ * Check the Appwrite database servers are up and connection is successful.
4375
4457
  *
4376
4458
  * @throws {AppwriteException}
4377
4459
  * @returns {Promise}
@@ -4386,6 +4468,43 @@ class Health extends Service {
4386
4468
  }, payload);
4387
4469
  });
4388
4470
  }
4471
+ /**
4472
+ * Get PubSub
4473
+ *
4474
+ * Check the Appwrite pub-sub servers are up and connection is successful.
4475
+ *
4476
+ * @throws {AppwriteException}
4477
+ * @returns {Promise}
4478
+ */
4479
+ getPubSub() {
4480
+ return __awaiter(this, void 0, void 0, function* () {
4481
+ let path = '/health/pubsub';
4482
+ let payload = {};
4483
+ const uri = new URL(this.client.config.endpoint + path);
4484
+ return yield this.client.call('get', uri, {
4485
+ 'content-type': 'application/json',
4486
+ }, payload);
4487
+ });
4488
+ }
4489
+ /**
4490
+ * Get Queue
4491
+ *
4492
+ * Check the Appwrite queue messaging servers are up and connection is
4493
+ * successful.
4494
+ *
4495
+ * @throws {AppwriteException}
4496
+ * @returns {Promise}
4497
+ */
4498
+ getQueue() {
4499
+ return __awaiter(this, void 0, void 0, function* () {
4500
+ let path = '/health/queue';
4501
+ let payload = {};
4502
+ const uri = new URL(this.client.config.endpoint + path);
4503
+ return yield this.client.call('get', uri, {
4504
+ 'content-type': 'application/json',
4505
+ }, payload);
4506
+ });
4507
+ }
4389
4508
  /**
4390
4509
  * Get Certificates Queue
4391
4510
  *
@@ -4649,6 +4768,33 @@ class Locale extends Service {
4649
4768
  }
4650
4769
  }
4651
4770
 
4771
+ class Project extends Service {
4772
+ constructor(client) {
4773
+ super(client);
4774
+ }
4775
+ /**
4776
+ * Get usage stats for a project
4777
+ *
4778
+ *
4779
+ * @param {string} range
4780
+ * @throws {AppwriteException}
4781
+ * @returns {Promise}
4782
+ */
4783
+ getUsage(range) {
4784
+ return __awaiter(this, void 0, void 0, function* () {
4785
+ let path = '/project/usage';
4786
+ let payload = {};
4787
+ if (typeof range !== 'undefined') {
4788
+ payload['range'] = range;
4789
+ }
4790
+ const uri = new URL(this.client.config.endpoint + path);
4791
+ return yield this.client.call('get', uri, {
4792
+ 'content-type': 'application/json',
4793
+ }, payload);
4794
+ });
4795
+ }
4796
+ }
4797
+
4652
4798
  class Projects extends Service {
4653
4799
  constructor(client) {
4654
4800
  super(client);
@@ -5555,31 +5701,6 @@ class Projects extends Service {
5555
5701
  }, payload);
5556
5702
  });
5557
5703
  }
5558
- /**
5559
- * Get usage stats for a project
5560
- *
5561
- *
5562
- * @param {string} projectId
5563
- * @param {string} range
5564
- * @throws {AppwriteException}
5565
- * @returns {Promise}
5566
- */
5567
- getUsage(projectId, range) {
5568
- return __awaiter(this, void 0, void 0, function* () {
5569
- if (typeof projectId === 'undefined') {
5570
- throw new AppwriteException('Missing required parameter: "projectId"');
5571
- }
5572
- let path = '/projects/{projectId}/usage'.replace('{projectId}', projectId);
5573
- let payload = {};
5574
- if (typeof range !== 'undefined') {
5575
- payload['range'] = range;
5576
- }
5577
- const uri = new URL(this.client.config.endpoint + path);
5578
- return yield this.client.call('get', uri, {
5579
- 'content-type': 'application/json',
5580
- }, payload);
5581
- });
5582
- }
5583
5704
  /**
5584
5705
  * List Webhooks
5585
5706
  *
@@ -6367,7 +6488,7 @@ class Storage extends Service {
6367
6488
  });
6368
6489
  }
6369
6490
  /**
6370
- * Get usage stats for a storage bucket
6491
+ * Get usage stats for storage bucket
6371
6492
  *
6372
6493
  *
6373
6494
  * @param {string} bucketId
@@ -7317,20 +7438,16 @@ class Users extends Service {
7317
7438
  *
7318
7439
  *
7319
7440
  * @param {string} range
7320
- * @param {string} provider
7321
7441
  * @throws {AppwriteException}
7322
7442
  * @returns {Promise}
7323
7443
  */
7324
- getUsage(range, provider) {
7444
+ getUsage(range) {
7325
7445
  return __awaiter(this, void 0, void 0, function* () {
7326
7446
  let path = '/users/usage';
7327
7447
  let payload = {};
7328
7448
  if (typeof range !== 'undefined') {
7329
7449
  payload['range'] = range;
7330
7450
  }
7331
- if (typeof provider !== 'undefined') {
7332
- payload['provider'] = provider;
7333
- }
7334
7451
  const uri = new URL(this.client.config.endpoint + path);
7335
7452
  return yield this.client.call('get', uri, {
7336
7453
  'content-type': 'application/json',
@@ -7819,5 +7936,5 @@ class ID {
7819
7936
  }
7820
7937
  }
7821
7938
 
7822
- export { Account, AppwriteException, Avatars, Client, Databases, Functions, Graphql, Health, ID, Locale, Permission, Projects, Query, Role, Storage, Teams, Users };
7939
+ export { Account, AppwriteException, Avatars, Client, Console, Databases, Functions, Graphql, Health, ID, Locale, Permission, Project, Projects, Query, Role, Storage, Teams, Users };
7823
7940
  //# sourceMappingURL=sdk.js.map