@appwrite.io/console 0.1.1 → 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/.github/workflows/publish.yml +18 -0
- package/README.md +2 -2
- package/dist/cjs/sdk.js +122 -34
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +122 -35
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +122 -34
- package/docs/examples/account/create-with-invite-code.md +18 -0
- package/docs/examples/health/get-pub-sub.md +18 -0
- package/docs/examples/health/get-queue.md +18 -0
- package/docs/examples/{projects → project}/get-usage.md +3 -3
- package/package.json +1 -1
- package/src/client.ts +1 -1
- package/src/index.ts +1 -0
- package/src/models.ts +96 -215
- package/src/services/account.ts +60 -0
- package/src/services/health.ts +39 -2
- package/src/services/project.ts +34 -0
- package/src/services/projects.ts +0 -27
- package/src/services/storage.ts +1 -1
- package/src/services/users.ts +1 -6
- package/types/index.d.ts +1 -0
- package/types/models.d.ts +96 -215
- package/types/services/account.d.ts +19 -0
- package/types/services/health.d.ts +21 -2
- package/types/services/project.d.ts +15 -0
- package/types/services/projects.d.ts +0 -10
- package/types/services/storage.d.ts +1 -1
- package/types/services/users.d.ts +1 -2
- package/.travis.yml +0 -32
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: Publish Package to npmjs
|
|
2
|
+
on:
|
|
3
|
+
release:
|
|
4
|
+
types: [published]
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
steps:
|
|
9
|
+
- uses: actions/checkout@v3
|
|
10
|
+
- uses: actions/setup-node@v3
|
|
11
|
+
with:
|
|
12
|
+
node-version: "16.x"
|
|
13
|
+
registry-url: "https://registry.npmjs.org"
|
|
14
|
+
- run: npm install
|
|
15
|
+
- run: npm run build
|
|
16
|
+
- run: npm publish
|
|
17
|
+
env:
|
|
18
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Appwrite Console SDK
|
|
2
2
|
|
|
3
3
|

|
|
4
|
-

|
|
5
5
|
[](https://travis-ci.com/appwrite/sdk-generator)
|
|
6
6
|
[](https://twitter.com/appwrite)
|
|
7
7
|
[](https://appwrite.io/discord)
|
|
@@ -33,7 +33,7 @@ import { Client, Account } from "@appwrite.io/console";
|
|
|
33
33
|
To install with a CDN (content delivery network) add the following scripts to the bottom of your <body> tag, but before you use any Appwrite services:
|
|
34
34
|
|
|
35
35
|
```html
|
|
36
|
-
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@0.
|
|
36
|
+
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@0.2.0"></script>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
|
package/dist/cjs/sdk.js
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.
|
|
107
|
+
'x-sdk-version': '0.2.0',
|
|
108
108
|
'X-Appwrite-Response-Format': '1.0.0',
|
|
109
109
|
};
|
|
110
110
|
this.realtime = {
|
|
@@ -546,6 +546,58 @@ class Account extends Service {
|
|
|
546
546
|
}, payload);
|
|
547
547
|
});
|
|
548
548
|
}
|
|
549
|
+
/**
|
|
550
|
+
* Create account using an invite code
|
|
551
|
+
*
|
|
552
|
+
* Use this endpoint to allow a new user to register a new account in your
|
|
553
|
+
* project. After the user registration completes successfully, you can use
|
|
554
|
+
* the [/account/verfication](/docs/client/account#accountCreateVerification)
|
|
555
|
+
* route to start verifying the user email address. To allow the new user to
|
|
556
|
+
* login to their new account, you need to create a new [account
|
|
557
|
+
* session](/docs/client/account#accountCreateSession).
|
|
558
|
+
*
|
|
559
|
+
* @param {string} userId
|
|
560
|
+
* @param {string} email
|
|
561
|
+
* @param {string} password
|
|
562
|
+
* @param {string} name
|
|
563
|
+
* @param {string} code
|
|
564
|
+
* @throws {AppwriteException}
|
|
565
|
+
* @returns {Promise}
|
|
566
|
+
*/
|
|
567
|
+
createWithInviteCode(userId, email, password, name, code) {
|
|
568
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
569
|
+
if (typeof userId === 'undefined') {
|
|
570
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
571
|
+
}
|
|
572
|
+
if (typeof email === 'undefined') {
|
|
573
|
+
throw new AppwriteException('Missing required parameter: "email"');
|
|
574
|
+
}
|
|
575
|
+
if (typeof password === 'undefined') {
|
|
576
|
+
throw new AppwriteException('Missing required parameter: "password"');
|
|
577
|
+
}
|
|
578
|
+
let path = '/account/invite';
|
|
579
|
+
let payload = {};
|
|
580
|
+
if (typeof userId !== 'undefined') {
|
|
581
|
+
payload['userId'] = userId;
|
|
582
|
+
}
|
|
583
|
+
if (typeof email !== 'undefined') {
|
|
584
|
+
payload['email'] = email;
|
|
585
|
+
}
|
|
586
|
+
if (typeof password !== 'undefined') {
|
|
587
|
+
payload['password'] = password;
|
|
588
|
+
}
|
|
589
|
+
if (typeof name !== 'undefined') {
|
|
590
|
+
payload['name'] = name;
|
|
591
|
+
}
|
|
592
|
+
if (typeof code !== 'undefined') {
|
|
593
|
+
payload['code'] = code;
|
|
594
|
+
}
|
|
595
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
596
|
+
return yield this.client.call('post', uri, {
|
|
597
|
+
'content-type': 'application/json',
|
|
598
|
+
}, payload);
|
|
599
|
+
});
|
|
600
|
+
}
|
|
549
601
|
/**
|
|
550
602
|
* Create JWT
|
|
551
603
|
*
|
|
@@ -4384,7 +4436,7 @@ class Health extends Service {
|
|
|
4384
4436
|
/**
|
|
4385
4437
|
* Get Cache
|
|
4386
4438
|
*
|
|
4387
|
-
* Check the Appwrite in-memory cache
|
|
4439
|
+
* Check the Appwrite in-memory cache servers are up and connection is
|
|
4388
4440
|
* successful.
|
|
4389
4441
|
*
|
|
4390
4442
|
* @throws {AppwriteException}
|
|
@@ -4403,7 +4455,7 @@ class Health extends Service {
|
|
|
4403
4455
|
/**
|
|
4404
4456
|
* Get DB
|
|
4405
4457
|
*
|
|
4406
|
-
* Check the Appwrite database
|
|
4458
|
+
* Check the Appwrite database servers are up and connection is successful.
|
|
4407
4459
|
*
|
|
4408
4460
|
* @throws {AppwriteException}
|
|
4409
4461
|
* @returns {Promise}
|
|
@@ -4418,6 +4470,43 @@ class Health extends Service {
|
|
|
4418
4470
|
}, payload);
|
|
4419
4471
|
});
|
|
4420
4472
|
}
|
|
4473
|
+
/**
|
|
4474
|
+
* Get PubSub
|
|
4475
|
+
*
|
|
4476
|
+
* Check the Appwrite pub-sub servers are up and connection is successful.
|
|
4477
|
+
*
|
|
4478
|
+
* @throws {AppwriteException}
|
|
4479
|
+
* @returns {Promise}
|
|
4480
|
+
*/
|
|
4481
|
+
getPubSub() {
|
|
4482
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4483
|
+
let path = '/health/pubsub';
|
|
4484
|
+
let payload = {};
|
|
4485
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
4486
|
+
return yield this.client.call('get', uri, {
|
|
4487
|
+
'content-type': 'application/json',
|
|
4488
|
+
}, payload);
|
|
4489
|
+
});
|
|
4490
|
+
}
|
|
4491
|
+
/**
|
|
4492
|
+
* Get Queue
|
|
4493
|
+
*
|
|
4494
|
+
* Check the Appwrite queue messaging servers are up and connection is
|
|
4495
|
+
* successful.
|
|
4496
|
+
*
|
|
4497
|
+
* @throws {AppwriteException}
|
|
4498
|
+
* @returns {Promise}
|
|
4499
|
+
*/
|
|
4500
|
+
getQueue() {
|
|
4501
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4502
|
+
let path = '/health/queue';
|
|
4503
|
+
let payload = {};
|
|
4504
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
4505
|
+
return yield this.client.call('get', uri, {
|
|
4506
|
+
'content-type': 'application/json',
|
|
4507
|
+
}, payload);
|
|
4508
|
+
});
|
|
4509
|
+
}
|
|
4421
4510
|
/**
|
|
4422
4511
|
* Get Certificates Queue
|
|
4423
4512
|
*
|
|
@@ -4681,6 +4770,33 @@ class Locale extends Service {
|
|
|
4681
4770
|
}
|
|
4682
4771
|
}
|
|
4683
4772
|
|
|
4773
|
+
class Project extends Service {
|
|
4774
|
+
constructor(client) {
|
|
4775
|
+
super(client);
|
|
4776
|
+
}
|
|
4777
|
+
/**
|
|
4778
|
+
* Get usage stats for a project
|
|
4779
|
+
*
|
|
4780
|
+
*
|
|
4781
|
+
* @param {string} range
|
|
4782
|
+
* @throws {AppwriteException}
|
|
4783
|
+
* @returns {Promise}
|
|
4784
|
+
*/
|
|
4785
|
+
getUsage(range) {
|
|
4786
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4787
|
+
let path = '/project/usage';
|
|
4788
|
+
let payload = {};
|
|
4789
|
+
if (typeof range !== 'undefined') {
|
|
4790
|
+
payload['range'] = range;
|
|
4791
|
+
}
|
|
4792
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
4793
|
+
return yield this.client.call('get', uri, {
|
|
4794
|
+
'content-type': 'application/json',
|
|
4795
|
+
}, payload);
|
|
4796
|
+
});
|
|
4797
|
+
}
|
|
4798
|
+
}
|
|
4799
|
+
|
|
4684
4800
|
class Projects extends Service {
|
|
4685
4801
|
constructor(client) {
|
|
4686
4802
|
super(client);
|
|
@@ -5587,31 +5703,6 @@ class Projects extends Service {
|
|
|
5587
5703
|
}, payload);
|
|
5588
5704
|
});
|
|
5589
5705
|
}
|
|
5590
|
-
/**
|
|
5591
|
-
* Get usage stats for a project
|
|
5592
|
-
*
|
|
5593
|
-
*
|
|
5594
|
-
* @param {string} projectId
|
|
5595
|
-
* @param {string} range
|
|
5596
|
-
* @throws {AppwriteException}
|
|
5597
|
-
* @returns {Promise}
|
|
5598
|
-
*/
|
|
5599
|
-
getUsage(projectId, range) {
|
|
5600
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
5601
|
-
if (typeof projectId === 'undefined') {
|
|
5602
|
-
throw new AppwriteException('Missing required parameter: "projectId"');
|
|
5603
|
-
}
|
|
5604
|
-
let path = '/projects/{projectId}/usage'.replace('{projectId}', projectId);
|
|
5605
|
-
let payload = {};
|
|
5606
|
-
if (typeof range !== 'undefined') {
|
|
5607
|
-
payload['range'] = range;
|
|
5608
|
-
}
|
|
5609
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
5610
|
-
return yield this.client.call('get', uri, {
|
|
5611
|
-
'content-type': 'application/json',
|
|
5612
|
-
}, payload);
|
|
5613
|
-
});
|
|
5614
|
-
}
|
|
5615
5706
|
/**
|
|
5616
5707
|
* List Webhooks
|
|
5617
5708
|
*
|
|
@@ -6399,7 +6490,7 @@ class Storage extends Service {
|
|
|
6399
6490
|
});
|
|
6400
6491
|
}
|
|
6401
6492
|
/**
|
|
6402
|
-
* Get usage stats for
|
|
6493
|
+
* Get usage stats for storage bucket
|
|
6403
6494
|
*
|
|
6404
6495
|
*
|
|
6405
6496
|
* @param {string} bucketId
|
|
@@ -7349,20 +7440,16 @@ class Users extends Service {
|
|
|
7349
7440
|
*
|
|
7350
7441
|
*
|
|
7351
7442
|
* @param {string} range
|
|
7352
|
-
* @param {string} provider
|
|
7353
7443
|
* @throws {AppwriteException}
|
|
7354
7444
|
* @returns {Promise}
|
|
7355
7445
|
*/
|
|
7356
|
-
getUsage(range
|
|
7446
|
+
getUsage(range) {
|
|
7357
7447
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7358
7448
|
let path = '/users/usage';
|
|
7359
7449
|
let payload = {};
|
|
7360
7450
|
if (typeof range !== 'undefined') {
|
|
7361
7451
|
payload['range'] = range;
|
|
7362
7452
|
}
|
|
7363
|
-
if (typeof provider !== 'undefined') {
|
|
7364
|
-
payload['provider'] = provider;
|
|
7365
|
-
}
|
|
7366
7453
|
const uri = new URL(this.client.config.endpoint + path);
|
|
7367
7454
|
return yield this.client.call('get', uri, {
|
|
7368
7455
|
'content-type': 'application/json',
|
|
@@ -7863,6 +7950,7 @@ exports.Health = Health;
|
|
|
7863
7950
|
exports.ID = ID;
|
|
7864
7951
|
exports.Locale = Locale;
|
|
7865
7952
|
exports.Permission = Permission;
|
|
7953
|
+
exports.Project = Project;
|
|
7866
7954
|
exports.Projects = Projects;
|
|
7867
7955
|
exports.Query = Query;
|
|
7868
7956
|
exports.Role = Role;
|