@appwrite.io/console 0.0.1
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/CHANGELOG.md +1 -0
- package/LICENSE +12 -0
- package/README.md +111 -0
- package/dist/cjs/package.json +3 -0
- package/dist/esm/package.json +3 -0
- package/docs/examples/account/create-anonymous-session.md +18 -0
- package/docs/examples/account/create-email-session.md +18 -0
- package/docs/examples/account/create-j-w-t.md +18 -0
- package/docs/examples/account/create-magic-u-r-l-session.md +18 -0
- package/docs/examples/account/create-o-auth2session.md +14 -0
- package/docs/examples/account/create-phone-session.md +18 -0
- package/docs/examples/account/create-phone-verification.md +18 -0
- package/docs/examples/account/create-recovery.md +18 -0
- package/docs/examples/account/create-verification.md +18 -0
- package/docs/examples/account/create.md +18 -0
- package/docs/examples/account/delete-session.md +18 -0
- package/docs/examples/account/delete-sessions.md +18 -0
- package/docs/examples/account/get-prefs.md +18 -0
- package/docs/examples/account/get-session.md +18 -0
- package/docs/examples/account/get.md +18 -0
- package/docs/examples/account/list-logs.md +18 -0
- package/docs/examples/account/list-sessions.md +18 -0
- package/docs/examples/account/update-email.md +18 -0
- package/docs/examples/account/update-magic-u-r-l-session.md +18 -0
- package/docs/examples/account/update-name.md +18 -0
- package/docs/examples/account/update-password.md +18 -0
- package/docs/examples/account/update-phone-session.md +18 -0
- package/docs/examples/account/update-phone-verification.md +18 -0
- package/docs/examples/account/update-phone.md +18 -0
- package/docs/examples/account/update-prefs.md +18 -0
- package/docs/examples/account/update-recovery.md +18 -0
- package/docs/examples/account/update-session.md +18 -0
- package/docs/examples/account/update-status.md +18 -0
- package/docs/examples/account/update-verification.md +18 -0
- package/docs/examples/avatars/get-browser.md +14 -0
- package/docs/examples/avatars/get-credit-card.md +14 -0
- package/docs/examples/avatars/get-favicon.md +14 -0
- package/docs/examples/avatars/get-flag.md +14 -0
- package/docs/examples/avatars/get-image.md +14 -0
- package/docs/examples/avatars/get-initials.md +14 -0
- package/docs/examples/avatars/get-q-r.md +14 -0
- package/docs/examples/databases/create-boolean-attribute.md +18 -0
- package/docs/examples/databases/create-collection.md +18 -0
- package/docs/examples/databases/create-datetime-attribute.md +18 -0
- package/docs/examples/databases/create-document.md +18 -0
- package/docs/examples/databases/create-email-attribute.md +18 -0
- package/docs/examples/databases/create-enum-attribute.md +18 -0
- package/docs/examples/databases/create-float-attribute.md +18 -0
- package/docs/examples/databases/create-index.md +18 -0
- package/docs/examples/databases/create-integer-attribute.md +18 -0
- package/docs/examples/databases/create-ip-attribute.md +18 -0
- package/docs/examples/databases/create-string-attribute.md +18 -0
- package/docs/examples/databases/create-url-attribute.md +18 -0
- package/docs/examples/databases/create.md +18 -0
- package/docs/examples/databases/delete-attribute.md +18 -0
- package/docs/examples/databases/delete-collection.md +18 -0
- package/docs/examples/databases/delete-document.md +18 -0
- package/docs/examples/databases/delete-index.md +18 -0
- package/docs/examples/databases/delete.md +18 -0
- package/docs/examples/databases/get-attribute.md +18 -0
- package/docs/examples/databases/get-collection-usage.md +18 -0
- package/docs/examples/databases/get-collection.md +18 -0
- package/docs/examples/databases/get-database-usage.md +18 -0
- package/docs/examples/databases/get-document.md +18 -0
- package/docs/examples/databases/get-index.md +18 -0
- package/docs/examples/databases/get-usage.md +18 -0
- package/docs/examples/databases/get.md +18 -0
- package/docs/examples/databases/list-attributes.md +18 -0
- package/docs/examples/databases/list-collection-logs.md +18 -0
- package/docs/examples/databases/list-collections.md +18 -0
- package/docs/examples/databases/list-document-logs.md +18 -0
- package/docs/examples/databases/list-documents.md +18 -0
- package/docs/examples/databases/list-indexes.md +18 -0
- package/docs/examples/databases/list-logs.md +18 -0
- package/docs/examples/databases/list.md +18 -0
- package/docs/examples/databases/update-collection.md +18 -0
- package/docs/examples/databases/update-document.md +18 -0
- package/docs/examples/databases/update.md +18 -0
- package/docs/examples/functions/create-build.md +18 -0
- package/docs/examples/functions/create-deployment.md +18 -0
- package/docs/examples/functions/create-execution.md +18 -0
- package/docs/examples/functions/create-variable.md +18 -0
- package/docs/examples/functions/create.md +18 -0
- package/docs/examples/functions/delete-deployment.md +18 -0
- package/docs/examples/functions/delete-variable.md +18 -0
- package/docs/examples/functions/delete.md +18 -0
- package/docs/examples/functions/get-deployment.md +18 -0
- package/docs/examples/functions/get-execution.md +18 -0
- package/docs/examples/functions/get-function-usage.md +18 -0
- package/docs/examples/functions/get-usage.md +18 -0
- package/docs/examples/functions/get-variable.md +18 -0
- package/docs/examples/functions/get.md +18 -0
- package/docs/examples/functions/list-deployments.md +18 -0
- package/docs/examples/functions/list-executions.md +18 -0
- package/docs/examples/functions/list-runtimes.md +18 -0
- package/docs/examples/functions/list-variables.md +18 -0
- package/docs/examples/functions/list.md +18 -0
- package/docs/examples/functions/update-deployment.md +18 -0
- package/docs/examples/functions/update-variable.md +18 -0
- package/docs/examples/functions/update.md +18 -0
- package/docs/examples/graphql/mutation.md +18 -0
- package/docs/examples/graphql/query.md +18 -0
- package/docs/examples/health/get-antivirus.md +18 -0
- package/docs/examples/health/get-cache.md +18 -0
- package/docs/examples/health/get-d-b.md +18 -0
- package/docs/examples/health/get-queue-certificates.md +18 -0
- package/docs/examples/health/get-queue-functions.md +18 -0
- package/docs/examples/health/get-queue-logs.md +18 -0
- package/docs/examples/health/get-queue-webhooks.md +18 -0
- package/docs/examples/health/get-storage-local.md +18 -0
- package/docs/examples/health/get-time.md +18 -0
- package/docs/examples/health/get.md +18 -0
- package/docs/examples/locale/get.md +18 -0
- package/docs/examples/locale/list-continents.md +18 -0
- package/docs/examples/locale/list-countries-e-u.md +18 -0
- package/docs/examples/locale/list-countries-phones.md +18 -0
- package/docs/examples/locale/list-countries.md +18 -0
- package/docs/examples/locale/list-currencies.md +18 -0
- package/docs/examples/locale/list-languages.md +18 -0
- package/docs/examples/projects/create-domain.md +18 -0
- package/docs/examples/projects/create-key.md +18 -0
- package/docs/examples/projects/create-platform.md +18 -0
- package/docs/examples/projects/create-webhook.md +18 -0
- package/docs/examples/projects/create.md +18 -0
- package/docs/examples/projects/delete-domain.md +18 -0
- package/docs/examples/projects/delete-key.md +18 -0
- package/docs/examples/projects/delete-platform.md +18 -0
- package/docs/examples/projects/delete-webhook.md +18 -0
- package/docs/examples/projects/delete.md +18 -0
- package/docs/examples/projects/get-domain.md +18 -0
- package/docs/examples/projects/get-key.md +18 -0
- package/docs/examples/projects/get-platform.md +18 -0
- package/docs/examples/projects/get-usage.md +18 -0
- package/docs/examples/projects/get-webhook.md +18 -0
- package/docs/examples/projects/get.md +18 -0
- package/docs/examples/projects/list-domains.md +18 -0
- package/docs/examples/projects/list-keys.md +18 -0
- package/docs/examples/projects/list-platforms.md +18 -0
- package/docs/examples/projects/list-webhooks.md +18 -0
- package/docs/examples/projects/list.md +18 -0
- package/docs/examples/projects/update-auth-duration.md +18 -0
- package/docs/examples/projects/update-auth-limit.md +18 -0
- package/docs/examples/projects/update-auth-sessions-limit.md +18 -0
- package/docs/examples/projects/update-auth-status.md +18 -0
- package/docs/examples/projects/update-domain-verification.md +18 -0
- package/docs/examples/projects/update-key.md +18 -0
- package/docs/examples/projects/update-o-auth2.md +18 -0
- package/docs/examples/projects/update-platform.md +18 -0
- package/docs/examples/projects/update-service-status.md +18 -0
- package/docs/examples/projects/update-webhook-signature.md +18 -0
- package/docs/examples/projects/update-webhook.md +18 -0
- package/docs/examples/projects/update.md +18 -0
- package/docs/examples/storage/create-bucket.md +18 -0
- package/docs/examples/storage/create-file.md +18 -0
- package/docs/examples/storage/delete-bucket.md +18 -0
- package/docs/examples/storage/delete-file.md +18 -0
- package/docs/examples/storage/get-bucket-usage.md +18 -0
- package/docs/examples/storage/get-bucket.md +18 -0
- package/docs/examples/storage/get-file-download.md +14 -0
- package/docs/examples/storage/get-file-preview.md +14 -0
- package/docs/examples/storage/get-file-view.md +14 -0
- package/docs/examples/storage/get-file.md +18 -0
- package/docs/examples/storage/get-usage.md +18 -0
- package/docs/examples/storage/list-buckets.md +18 -0
- package/docs/examples/storage/list-files.md +18 -0
- package/docs/examples/storage/update-bucket.md +18 -0
- package/docs/examples/storage/update-file.md +18 -0
- package/docs/examples/teams/create-membership.md +18 -0
- package/docs/examples/teams/create.md +18 -0
- package/docs/examples/teams/delete-membership.md +18 -0
- package/docs/examples/teams/delete.md +18 -0
- package/docs/examples/teams/get-membership.md +18 -0
- package/docs/examples/teams/get.md +18 -0
- package/docs/examples/teams/list-logs.md +18 -0
- package/docs/examples/teams/list-memberships.md +18 -0
- package/docs/examples/teams/list.md +18 -0
- package/docs/examples/teams/update-membership-roles.md +18 -0
- package/docs/examples/teams/update-membership-status.md +18 -0
- package/docs/examples/teams/update.md +18 -0
- package/docs/examples/users/create-argon2user.md +18 -0
- package/docs/examples/users/create-bcrypt-user.md +18 -0
- package/docs/examples/users/create-m-d5user.md +18 -0
- package/docs/examples/users/create-p-h-pass-user.md +18 -0
- package/docs/examples/users/create-s-h-a-user.md +18 -0
- package/docs/examples/users/create-scrypt-modified-user.md +18 -0
- package/docs/examples/users/create-scrypt-user.md +18 -0
- package/docs/examples/users/create.md +18 -0
- package/docs/examples/users/delete-session.md +18 -0
- package/docs/examples/users/delete-sessions.md +18 -0
- package/docs/examples/users/delete.md +18 -0
- package/docs/examples/users/get-prefs.md +18 -0
- package/docs/examples/users/get-usage.md +18 -0
- package/docs/examples/users/get.md +18 -0
- package/docs/examples/users/list-logs.md +18 -0
- package/docs/examples/users/list-memberships.md +18 -0
- package/docs/examples/users/list-sessions.md +18 -0
- package/docs/examples/users/list.md +18 -0
- package/docs/examples/users/update-email-verification.md +18 -0
- package/docs/examples/users/update-email.md +18 -0
- package/docs/examples/users/update-name.md +18 -0
- package/docs/examples/users/update-password.md +18 -0
- package/docs/examples/users/update-phone-verification.md +18 -0
- package/docs/examples/users/update-phone.md +18 -0
- package/docs/examples/users/update-prefs.md +18 -0
- package/docs/examples/users/update-status.md +18 -0
- package/package.json +40 -0
- package/rollup.config.js +31 -0
- package/src/client.ts +472 -0
- package/src/id.ts +9 -0
- package/src/index.ts +17 -0
- package/src/models.ts +2540 -0
- package/src/permission.ts +22 -0
- package/src/query.ts +56 -0
- package/src/role.ts +34 -0
- package/src/service.ts +30 -0
- package/src/services/account.ts +1009 -0
- package/src/services/avatars.ts +351 -0
- package/src/services/databases.ts +1525 -0
- package/src/services/functions.ts +814 -0
- package/src/services/graphql.ts +68 -0
- package/src/services/health.ts +202 -0
- package/src/services/locale.ts +150 -0
- package/src/services/projects.ts +1235 -0
- package/src/services/storage.ts +691 -0
- package/src/services/teams.ts +445 -0
- package/src/services/users.ts +1020 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Service } from '../service';
|
|
2
|
+
import { AppwriteException, Client } from '../client';
|
|
3
|
+
import type { Models } from '../models';
|
|
4
|
+
import type { UploadProgress, Payload } from '../client';
|
|
5
|
+
|
|
6
|
+
export class Graphql extends Service {
|
|
7
|
+
|
|
8
|
+
constructor(client: Client)
|
|
9
|
+
{
|
|
10
|
+
super(client);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* GraphQL Endpoint
|
|
15
|
+
*
|
|
16
|
+
* Execute a GraphQL mutation.
|
|
17
|
+
*
|
|
18
|
+
* @param {object} query
|
|
19
|
+
* @throws {AppwriteException}
|
|
20
|
+
* @returns {Promise}
|
|
21
|
+
*/
|
|
22
|
+
async query(query: object): Promise<{}> {
|
|
23
|
+
if (typeof query === 'undefined') {
|
|
24
|
+
throw new AppwriteException('Missing required parameter: "query"');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let path = '/graphql';
|
|
28
|
+
let payload: Payload = {};
|
|
29
|
+
|
|
30
|
+
if (typeof query !== 'undefined') {
|
|
31
|
+
payload['query'] = query;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
35
|
+
return await this.client.call('post', uri, {
|
|
36
|
+
'x-sdk-graphql': 'true',
|
|
37
|
+
'content-type': 'application/json',
|
|
38
|
+
}, payload);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* GraphQL Endpoint
|
|
43
|
+
*
|
|
44
|
+
* Execute a GraphQL mutation.
|
|
45
|
+
*
|
|
46
|
+
* @param {object} query
|
|
47
|
+
* @throws {AppwriteException}
|
|
48
|
+
* @returns {Promise}
|
|
49
|
+
*/
|
|
50
|
+
async mutation(query: object): Promise<{}> {
|
|
51
|
+
if (typeof query === 'undefined') {
|
|
52
|
+
throw new AppwriteException('Missing required parameter: "query"');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
let path = '/graphql/mutation';
|
|
56
|
+
let payload: Payload = {};
|
|
57
|
+
|
|
58
|
+
if (typeof query !== 'undefined') {
|
|
59
|
+
payload['query'] = query;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
63
|
+
return await this.client.call('post', uri, {
|
|
64
|
+
'x-sdk-graphql': 'true',
|
|
65
|
+
'content-type': 'application/json',
|
|
66
|
+
}, payload);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { Service } from '../service';
|
|
2
|
+
import { AppwriteException, Client } from '../client';
|
|
3
|
+
import type { Models } from '../models';
|
|
4
|
+
import type { UploadProgress, Payload } from '../client';
|
|
5
|
+
|
|
6
|
+
export class Health extends Service {
|
|
7
|
+
|
|
8
|
+
constructor(client: Client)
|
|
9
|
+
{
|
|
10
|
+
super(client);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Get HTTP
|
|
15
|
+
*
|
|
16
|
+
* Check the Appwrite HTTP server is up and responsive.
|
|
17
|
+
*
|
|
18
|
+
* @throws {AppwriteException}
|
|
19
|
+
* @returns {Promise}
|
|
20
|
+
*/
|
|
21
|
+
async get(): Promise<Models.HealthStatus> {
|
|
22
|
+
let path = '/health';
|
|
23
|
+
let payload: Payload = {};
|
|
24
|
+
|
|
25
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
26
|
+
return await this.client.call('get', uri, {
|
|
27
|
+
'content-type': 'application/json',
|
|
28
|
+
}, payload);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get Antivirus
|
|
33
|
+
*
|
|
34
|
+
* Check the Appwrite Antivirus server is up and connection is successful.
|
|
35
|
+
*
|
|
36
|
+
* @throws {AppwriteException}
|
|
37
|
+
* @returns {Promise}
|
|
38
|
+
*/
|
|
39
|
+
async getAntivirus(): Promise<Models.HealthAntivirus> {
|
|
40
|
+
let path = '/health/anti-virus';
|
|
41
|
+
let payload: Payload = {};
|
|
42
|
+
|
|
43
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
44
|
+
return await this.client.call('get', uri, {
|
|
45
|
+
'content-type': 'application/json',
|
|
46
|
+
}, payload);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Get Cache
|
|
51
|
+
*
|
|
52
|
+
* Check the Appwrite in-memory cache server is up and connection is
|
|
53
|
+
* successful.
|
|
54
|
+
*
|
|
55
|
+
* @throws {AppwriteException}
|
|
56
|
+
* @returns {Promise}
|
|
57
|
+
*/
|
|
58
|
+
async getCache(): Promise<Models.HealthStatus> {
|
|
59
|
+
let path = '/health/cache';
|
|
60
|
+
let payload: Payload = {};
|
|
61
|
+
|
|
62
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
63
|
+
return await this.client.call('get', uri, {
|
|
64
|
+
'content-type': 'application/json',
|
|
65
|
+
}, payload);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Get DB
|
|
70
|
+
*
|
|
71
|
+
* Check the Appwrite database server is up and connection is successful.
|
|
72
|
+
*
|
|
73
|
+
* @throws {AppwriteException}
|
|
74
|
+
* @returns {Promise}
|
|
75
|
+
*/
|
|
76
|
+
async getDB(): Promise<Models.HealthStatus> {
|
|
77
|
+
let path = '/health/db';
|
|
78
|
+
let payload: Payload = {};
|
|
79
|
+
|
|
80
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
81
|
+
return await this.client.call('get', uri, {
|
|
82
|
+
'content-type': 'application/json',
|
|
83
|
+
}, payload);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Get Certificates Queue
|
|
88
|
+
*
|
|
89
|
+
* Get the number of certificates that are waiting to be issued against
|
|
90
|
+
* [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue
|
|
91
|
+
* server.
|
|
92
|
+
*
|
|
93
|
+
* @throws {AppwriteException}
|
|
94
|
+
* @returns {Promise}
|
|
95
|
+
*/
|
|
96
|
+
async getQueueCertificates(): Promise<Models.HealthQueue> {
|
|
97
|
+
let path = '/health/queue/certificates';
|
|
98
|
+
let payload: Payload = {};
|
|
99
|
+
|
|
100
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
101
|
+
return await this.client.call('get', uri, {
|
|
102
|
+
'content-type': 'application/json',
|
|
103
|
+
}, payload);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Get Functions Queue
|
|
108
|
+
*
|
|
109
|
+
*
|
|
110
|
+
* @throws {AppwriteException}
|
|
111
|
+
* @returns {Promise}
|
|
112
|
+
*/
|
|
113
|
+
async getQueueFunctions(): Promise<Models.HealthQueue> {
|
|
114
|
+
let path = '/health/queue/functions';
|
|
115
|
+
let payload: Payload = {};
|
|
116
|
+
|
|
117
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
118
|
+
return await this.client.call('get', uri, {
|
|
119
|
+
'content-type': 'application/json',
|
|
120
|
+
}, payload);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Get Logs Queue
|
|
125
|
+
*
|
|
126
|
+
* Get the number of logs that are waiting to be processed in the Appwrite
|
|
127
|
+
* internal queue server.
|
|
128
|
+
*
|
|
129
|
+
* @throws {AppwriteException}
|
|
130
|
+
* @returns {Promise}
|
|
131
|
+
*/
|
|
132
|
+
async getQueueLogs(): Promise<Models.HealthQueue> {
|
|
133
|
+
let path = '/health/queue/logs';
|
|
134
|
+
let payload: Payload = {};
|
|
135
|
+
|
|
136
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
137
|
+
return await this.client.call('get', uri, {
|
|
138
|
+
'content-type': 'application/json',
|
|
139
|
+
}, payload);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Get Webhooks Queue
|
|
144
|
+
*
|
|
145
|
+
* Get the number of webhooks that are waiting to be processed in the Appwrite
|
|
146
|
+
* internal queue server.
|
|
147
|
+
*
|
|
148
|
+
* @throws {AppwriteException}
|
|
149
|
+
* @returns {Promise}
|
|
150
|
+
*/
|
|
151
|
+
async getQueueWebhooks(): Promise<Models.HealthQueue> {
|
|
152
|
+
let path = '/health/queue/webhooks';
|
|
153
|
+
let payload: Payload = {};
|
|
154
|
+
|
|
155
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
156
|
+
return await this.client.call('get', uri, {
|
|
157
|
+
'content-type': 'application/json',
|
|
158
|
+
}, payload);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Get Local Storage
|
|
163
|
+
*
|
|
164
|
+
* Check the Appwrite local storage device is up and connection is successful.
|
|
165
|
+
*
|
|
166
|
+
* @throws {AppwriteException}
|
|
167
|
+
* @returns {Promise}
|
|
168
|
+
*/
|
|
169
|
+
async getStorageLocal(): Promise<Models.HealthStatus> {
|
|
170
|
+
let path = '/health/storage/local';
|
|
171
|
+
let payload: Payload = {};
|
|
172
|
+
|
|
173
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
174
|
+
return await this.client.call('get', uri, {
|
|
175
|
+
'content-type': 'application/json',
|
|
176
|
+
}, payload);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Get Time
|
|
181
|
+
*
|
|
182
|
+
* Check the Appwrite server time is synced with Google remote NTP server. We
|
|
183
|
+
* use this technology to smoothly handle leap seconds with no disruptive
|
|
184
|
+
* events. The [Network Time
|
|
185
|
+
* Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is
|
|
186
|
+
* used by hundreds of millions of computers and devices to synchronize their
|
|
187
|
+
* clocks over the Internet. If your computer sets its own clock, it likely
|
|
188
|
+
* uses NTP.
|
|
189
|
+
*
|
|
190
|
+
* @throws {AppwriteException}
|
|
191
|
+
* @returns {Promise}
|
|
192
|
+
*/
|
|
193
|
+
async getTime(): Promise<Models.HealthTime> {
|
|
194
|
+
let path = '/health/time';
|
|
195
|
+
let payload: Payload = {};
|
|
196
|
+
|
|
197
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
198
|
+
return await this.client.call('get', uri, {
|
|
199
|
+
'content-type': 'application/json',
|
|
200
|
+
}, payload);
|
|
201
|
+
}
|
|
202
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { Service } from '../service';
|
|
2
|
+
import { AppwriteException, Client } from '../client';
|
|
3
|
+
import type { Models } from '../models';
|
|
4
|
+
import type { UploadProgress, Payload } from '../client';
|
|
5
|
+
|
|
6
|
+
export class Locale extends Service {
|
|
7
|
+
|
|
8
|
+
constructor(client: Client)
|
|
9
|
+
{
|
|
10
|
+
super(client);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Get User Locale
|
|
15
|
+
*
|
|
16
|
+
* Get the current user location based on IP. Returns an object with user
|
|
17
|
+
* country code, country name, continent name, continent code, ip address and
|
|
18
|
+
* suggested currency. You can use the locale header to get the data in a
|
|
19
|
+
* supported language.
|
|
20
|
+
*
|
|
21
|
+
* ([IP Geolocation by DB-IP](https://db-ip.com))
|
|
22
|
+
*
|
|
23
|
+
* @throws {AppwriteException}
|
|
24
|
+
* @returns {Promise}
|
|
25
|
+
*/
|
|
26
|
+
async get(): Promise<Models.Locale> {
|
|
27
|
+
let path = '/locale';
|
|
28
|
+
let payload: Payload = {};
|
|
29
|
+
|
|
30
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
31
|
+
return await this.client.call('get', uri, {
|
|
32
|
+
'content-type': 'application/json',
|
|
33
|
+
}, payload);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* List Continents
|
|
38
|
+
*
|
|
39
|
+
* List of all continents. You can use the locale header to get the data in a
|
|
40
|
+
* supported language.
|
|
41
|
+
*
|
|
42
|
+
* @throws {AppwriteException}
|
|
43
|
+
* @returns {Promise}
|
|
44
|
+
*/
|
|
45
|
+
async listContinents(): Promise<Models.ContinentList> {
|
|
46
|
+
let path = '/locale/continents';
|
|
47
|
+
let payload: Payload = {};
|
|
48
|
+
|
|
49
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
50
|
+
return await this.client.call('get', uri, {
|
|
51
|
+
'content-type': 'application/json',
|
|
52
|
+
}, payload);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* List Countries
|
|
57
|
+
*
|
|
58
|
+
* List of all countries. You can use the locale header to get the data in a
|
|
59
|
+
* supported language.
|
|
60
|
+
*
|
|
61
|
+
* @throws {AppwriteException}
|
|
62
|
+
* @returns {Promise}
|
|
63
|
+
*/
|
|
64
|
+
async listCountries(): Promise<Models.CountryList> {
|
|
65
|
+
let path = '/locale/countries';
|
|
66
|
+
let payload: Payload = {};
|
|
67
|
+
|
|
68
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
69
|
+
return await this.client.call('get', uri, {
|
|
70
|
+
'content-type': 'application/json',
|
|
71
|
+
}, payload);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* List EU Countries
|
|
76
|
+
*
|
|
77
|
+
* List of all countries that are currently members of the EU. You can use the
|
|
78
|
+
* locale header to get the data in a supported language.
|
|
79
|
+
*
|
|
80
|
+
* @throws {AppwriteException}
|
|
81
|
+
* @returns {Promise}
|
|
82
|
+
*/
|
|
83
|
+
async listCountriesEU(): Promise<Models.CountryList> {
|
|
84
|
+
let path = '/locale/countries/eu';
|
|
85
|
+
let payload: Payload = {};
|
|
86
|
+
|
|
87
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
88
|
+
return await this.client.call('get', uri, {
|
|
89
|
+
'content-type': 'application/json',
|
|
90
|
+
}, payload);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* List Countries Phone Codes
|
|
95
|
+
*
|
|
96
|
+
* List of all countries phone codes. You can use the locale header to get the
|
|
97
|
+
* data in a supported language.
|
|
98
|
+
*
|
|
99
|
+
* @throws {AppwriteException}
|
|
100
|
+
* @returns {Promise}
|
|
101
|
+
*/
|
|
102
|
+
async listCountriesPhones(): Promise<Models.PhoneList> {
|
|
103
|
+
let path = '/locale/countries/phones';
|
|
104
|
+
let payload: Payload = {};
|
|
105
|
+
|
|
106
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
107
|
+
return await this.client.call('get', uri, {
|
|
108
|
+
'content-type': 'application/json',
|
|
109
|
+
}, payload);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* List Currencies
|
|
114
|
+
*
|
|
115
|
+
* List of all currencies, including currency symbol, name, plural, and
|
|
116
|
+
* decimal digits for all major and minor currencies. You can use the locale
|
|
117
|
+
* header to get the data in a supported language.
|
|
118
|
+
*
|
|
119
|
+
* @throws {AppwriteException}
|
|
120
|
+
* @returns {Promise}
|
|
121
|
+
*/
|
|
122
|
+
async listCurrencies(): Promise<Models.CurrencyList> {
|
|
123
|
+
let path = '/locale/currencies';
|
|
124
|
+
let payload: Payload = {};
|
|
125
|
+
|
|
126
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
127
|
+
return await this.client.call('get', uri, {
|
|
128
|
+
'content-type': 'application/json',
|
|
129
|
+
}, payload);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* List Languages
|
|
134
|
+
*
|
|
135
|
+
* List of all languages classified by ISO 639-1 including 2-letter code, name
|
|
136
|
+
* in English, and name in the respective language.
|
|
137
|
+
*
|
|
138
|
+
* @throws {AppwriteException}
|
|
139
|
+
* @returns {Promise}
|
|
140
|
+
*/
|
|
141
|
+
async listLanguages(): Promise<Models.LanguageList> {
|
|
142
|
+
let path = '/locale/languages';
|
|
143
|
+
let payload: Payload = {};
|
|
144
|
+
|
|
145
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
146
|
+
return await this.client.call('get', uri, {
|
|
147
|
+
'content-type': 'application/json',
|
|
148
|
+
}, payload);
|
|
149
|
+
}
|
|
150
|
+
};
|