react-native-appwrite 0.2.2 → 0.3.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 +13 -4
- package/CHANGELOG.md +1 -1
- package/LICENSE +1 -1
- package/README.md +22 -9
- package/dist/cjs/sdk.js +1193 -269
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +1193 -270
- package/dist/esm/sdk.js.map +1 -1
- package/docs/examples/account/create-anonymous-session.md +6 -13
- package/docs/examples/account/create-email-password-session.md +14 -0
- package/docs/examples/account/create-email-token.md +15 -0
- package/docs/examples/account/create-j-w-t.md +6 -13
- package/docs/examples/account/create-magic-u-r-l-token.md +16 -0
- package/docs/examples/account/create-mfa-authenticator.md +13 -0
- package/docs/examples/account/create-mfa-challenge.md +13 -0
- package/docs/examples/account/create-mfa-recovery-codes.md +11 -0
- package/docs/examples/account/create-o-auth2session.md +10 -9
- package/docs/examples/account/create-o-auth2token.md +15 -0
- package/docs/examples/account/create-phone-token.md +14 -0
- package/docs/examples/account/create-phone-verification.md +6 -13
- package/docs/examples/account/create-push-target.md +15 -0
- package/docs/examples/account/create-recovery.md +9 -13
- package/docs/examples/account/create-session.md +14 -0
- package/docs/examples/account/create-verification.md +8 -13
- package/docs/examples/account/create.md +11 -13
- package/docs/examples/account/delete-identity.md +8 -13
- package/docs/examples/account/delete-mfa-authenticator.md +14 -0
- package/docs/examples/account/delete-push-target.md +13 -0
- package/docs/examples/account/delete-session.md +8 -13
- package/docs/examples/account/delete-sessions.md +6 -13
- package/docs/examples/account/get-mfa-recovery-codes.md +11 -0
- package/docs/examples/account/get-prefs.md +6 -13
- package/docs/examples/account/get-session.md +8 -13
- package/docs/examples/account/get.md +6 -13
- package/docs/examples/account/list-identities.md +8 -13
- package/docs/examples/account/list-logs.md +8 -13
- package/docs/examples/account/list-mfa-factors.md +11 -0
- package/docs/examples/account/list-sessions.md +6 -13
- package/docs/examples/account/update-email.md +9 -13
- package/docs/examples/account/update-m-f-a.md +13 -0
- package/docs/examples/account/update-magic-u-r-l-session.md +9 -13
- package/docs/examples/account/update-mfa-authenticator.md +14 -0
- package/docs/examples/account/update-mfa-challenge.md +14 -0
- package/docs/examples/account/update-mfa-recovery-codes.md +11 -0
- package/docs/examples/account/update-name.md +8 -13
- package/docs/examples/account/update-password.md +9 -13
- package/docs/examples/account/update-phone-session.md +9 -13
- package/docs/examples/account/update-phone-verification.md +9 -13
- package/docs/examples/account/update-phone.md +9 -13
- package/docs/examples/account/update-prefs.md +8 -13
- package/docs/examples/account/update-push-target.md +14 -0
- package/docs/examples/account/update-recovery.md +10 -13
- package/docs/examples/account/update-session.md +8 -13
- package/docs/examples/account/update-status.md +6 -13
- package/docs/examples/account/update-verification.md +9 -13
- package/docs/examples/avatars/get-browser.md +11 -9
- package/docs/examples/avatars/get-credit-card.md +11 -9
- package/docs/examples/avatars/get-favicon.md +8 -9
- package/docs/examples/avatars/get-flag.md +11 -9
- package/docs/examples/avatars/get-image.md +10 -9
- package/docs/examples/avatars/get-initials.md +11 -9
- package/docs/examples/avatars/get-q-r.md +11 -9
- package/docs/examples/databases/create-document.md +12 -13
- package/docs/examples/databases/delete-document.md +10 -13
- package/docs/examples/databases/get-document.md +11 -13
- package/docs/examples/databases/list-documents.md +10 -13
- package/docs/examples/databases/update-document.md +12 -13
- package/docs/examples/functions/create-execution.md +13 -13
- package/docs/examples/functions/get-execution.md +9 -13
- package/docs/examples/functions/list-executions.md +10 -13
- package/docs/examples/graphql/mutation.md +8 -13
- package/docs/examples/graphql/query.md +8 -13
- package/docs/examples/locale/get.md +6 -13
- package/docs/examples/locale/list-codes.md +6 -13
- package/docs/examples/locale/list-continents.md +6 -13
- package/docs/examples/locale/list-countries-e-u.md +6 -13
- package/docs/examples/locale/list-countries-phones.md +6 -13
- package/docs/examples/locale/list-countries.md +6 -13
- package/docs/examples/locale/list-currencies.md +6 -13
- package/docs/examples/locale/list-languages.md +6 -13
- package/docs/examples/messaging/create-subscriber.md +15 -0
- package/docs/examples/messaging/delete-subscriber.md +14 -0
- package/docs/examples/storage/create-file.md +11 -13
- package/docs/examples/storage/delete-file.md +9 -13
- package/docs/examples/storage/get-file-download.md +9 -9
- package/docs/examples/storage/get-file-preview.md +20 -9
- package/docs/examples/storage/get-file-view.md +9 -9
- package/docs/examples/storage/get-file.md +9 -13
- package/docs/examples/storage/list-files.md +10 -13
- package/docs/examples/storage/update-file.md +11 -13
- package/docs/examples/teams/create-membership.md +14 -13
- package/docs/examples/teams/create.md +10 -13
- package/docs/examples/teams/delete-membership.md +9 -13
- package/docs/examples/teams/delete.md +8 -13
- package/docs/examples/teams/get-membership.md +9 -13
- package/docs/examples/teams/get-prefs.md +8 -13
- package/docs/examples/teams/get.md +8 -13
- package/docs/examples/teams/list-memberships.md +10 -13
- package/docs/examples/teams/list.md +9 -13
- package/docs/examples/teams/update-membership-status.md +11 -13
- package/docs/examples/teams/update-membership.md +10 -13
- package/docs/examples/teams/update-name.md +9 -13
- package/docs/examples/teams/update-prefs.md +9 -13
- package/package.json +1 -1
- package/src/client.ts +37 -11
- package/src/enums/authentication-factor.ts +6 -0
- package/src/enums/authenticator-type.ts +3 -0
- package/src/enums/browser.ts +16 -0
- package/src/enums/credit-card.ts +18 -0
- package/src/enums/execution-method.ts +8 -0
- package/src/enums/flag.ts +197 -0
- package/src/enums/image-format.ts +7 -0
- package/src/enums/image-gravity.ts +11 -0
- package/src/enums/o-auth-provider.ts +41 -0
- package/src/id.ts +23 -4
- package/src/index.ts +13 -2
- package/src/models.ts +174 -0
- package/src/query.ts +61 -34
- package/src/service.ts +4 -7
- package/src/services/account.ts +643 -119
- package/src/services/avatars.ts +12 -6
- package/src/services/databases.ts +7 -4
- package/src/services/functions.ts +6 -2
- package/src/services/graphql.ts +3 -0
- package/src/services/locale.ts +3 -0
- package/src/services/messaging.ts +84 -0
- package/src/services/storage.ts +12 -6
- package/src/services/teams.ts +3 -0
- package/docs/examples/account/create-email-session.md +0 -18
- package/docs/examples/account/create-magic-u-r-l-session.md +0 -18
- package/docs/examples/account/create-phone-session.md +0 -18
package/dist/esm/sdk.js
CHANGED
|
@@ -24,6 +24,12 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
24
24
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
25
25
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
26
26
|
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
30
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
31
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
32
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
class Service {
|
|
@@ -32,11 +38,10 @@ class Service {
|
|
|
32
38
|
}
|
|
33
39
|
static flatten(data, prefix = '') {
|
|
34
40
|
let output = {};
|
|
35
|
-
for (const key
|
|
36
|
-
let
|
|
37
|
-
let finalKey = prefix ? `${prefix}[${key}]` : key;
|
|
41
|
+
for (const [key, value] of Object.entries(data)) {
|
|
42
|
+
let finalKey = prefix ? prefix + '[' + key + ']' : key;
|
|
38
43
|
if (Array.isArray(value)) {
|
|
39
|
-
output = Object.assign(output,
|
|
44
|
+
output = Object.assign(Object.assign({}, output), Service.flatten(value, finalKey));
|
|
40
45
|
}
|
|
41
46
|
else {
|
|
42
47
|
output[finalKey] = value;
|
|
@@ -47,36 +52,6 @@ class Service {
|
|
|
47
52
|
}
|
|
48
53
|
Service.CHUNK_SIZE = 5 * 1024 * 1024; // 5MB
|
|
49
54
|
|
|
50
|
-
class Query {
|
|
51
|
-
}
|
|
52
|
-
Query.equal = (attribute, value) => Query.addQuery(attribute, "equal", value);
|
|
53
|
-
Query.notEqual = (attribute, value) => Query.addQuery(attribute, "notEqual", value);
|
|
54
|
-
Query.lessThan = (attribute, value) => Query.addQuery(attribute, "lessThan", value);
|
|
55
|
-
Query.lessThanEqual = (attribute, value) => Query.addQuery(attribute, "lessThanEqual", value);
|
|
56
|
-
Query.greaterThan = (attribute, value) => Query.addQuery(attribute, "greaterThan", value);
|
|
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(",")}])`;
|
|
64
|
-
Query.search = (attribute, value) => Query.addQuery(attribute, "search", value);
|
|
65
|
-
Query.orderDesc = (attribute) => `orderDesc("${attribute}")`;
|
|
66
|
-
Query.orderAsc = (attribute) => `orderAsc("${attribute}")`;
|
|
67
|
-
Query.cursorAfter = (documentId) => `cursorAfter("${documentId}")`;
|
|
68
|
-
Query.cursorBefore = (documentId) => `cursorBefore("${documentId}")`;
|
|
69
|
-
Query.limit = (limit) => `limit(${limit})`;
|
|
70
|
-
Query.offset = (offset) => `offset(${offset})`;
|
|
71
|
-
Query.addQuery = (attribute, method, value) => value instanceof Array
|
|
72
|
-
? `${method}("${attribute}", [${value
|
|
73
|
-
.map((v) => Query.parseValues(v))
|
|
74
|
-
.join(",")}])`
|
|
75
|
-
: `${method}("${attribute}", [${Query.parseValues(value)}])`;
|
|
76
|
-
Query.parseValues = (value) => typeof value === "string" || value instanceof String
|
|
77
|
-
? `"${value}"`
|
|
78
|
-
: `${value}`;
|
|
79
|
-
|
|
80
55
|
class AppwriteException extends Error {
|
|
81
56
|
constructor(message, code = 0, type = '', response = '') {
|
|
82
57
|
super(message);
|
|
@@ -90,19 +65,20 @@ class AppwriteException extends Error {
|
|
|
90
65
|
class Client {
|
|
91
66
|
constructor() {
|
|
92
67
|
this.config = {
|
|
93
|
-
endpoint: 'https://
|
|
68
|
+
endpoint: 'https://cloud.appwrite.io/v1',
|
|
94
69
|
endpointRealtime: '',
|
|
95
70
|
project: '',
|
|
96
71
|
jwt: '',
|
|
97
72
|
locale: '',
|
|
73
|
+
session: '',
|
|
98
74
|
platform: '',
|
|
99
75
|
};
|
|
100
76
|
this.headers = {
|
|
101
|
-
'x-sdk-name': '
|
|
77
|
+
'x-sdk-name': 'React Native',
|
|
102
78
|
'x-sdk-platform': 'client',
|
|
103
|
-
'x-sdk-language': '
|
|
104
|
-
'x-sdk-version': '
|
|
105
|
-
'X-Appwrite-Response-Format': '1.
|
|
79
|
+
'x-sdk-language': 'reactnative',
|
|
80
|
+
'x-sdk-version': '0.3.0',
|
|
81
|
+
'X-Appwrite-Response-Format': '1.5.0',
|
|
106
82
|
};
|
|
107
83
|
this.realtime = {
|
|
108
84
|
socket: undefined,
|
|
@@ -133,9 +109,12 @@ class Client {
|
|
|
133
109
|
}
|
|
134
110
|
},
|
|
135
111
|
createSocket: () => {
|
|
136
|
-
var _a, _b;
|
|
137
|
-
if (this.realtime.channels.size < 1)
|
|
112
|
+
var _a, _b, _c;
|
|
113
|
+
if (this.realtime.channels.size < 1) {
|
|
114
|
+
this.realtime.reconnect = false;
|
|
115
|
+
(_a = this.realtime.socket) === null || _a === void 0 ? void 0 : _a.close();
|
|
138
116
|
return;
|
|
117
|
+
}
|
|
139
118
|
const channels = new URLSearchParams();
|
|
140
119
|
channels.set('project', this.config.project);
|
|
141
120
|
this.realtime.channels.forEach(channel => {
|
|
@@ -144,10 +123,10 @@ class Client {
|
|
|
144
123
|
const url = this.config.endpointRealtime + '/realtime?' + channels.toString();
|
|
145
124
|
if (url !== this.realtime.url || // Check if URL is present
|
|
146
125
|
!this.realtime.socket || // Check if WebSocket has not been created
|
|
147
|
-
((
|
|
126
|
+
((_b = this.realtime.socket) === null || _b === void 0 ? void 0 : _b.readyState) > WebSocket.OPEN // Check if WebSocket is CLOSING (3) or CLOSED (4)
|
|
148
127
|
) {
|
|
149
128
|
if (this.realtime.socket &&
|
|
150
|
-
((
|
|
129
|
+
((_c = this.realtime.socket) === null || _c === void 0 ? void 0 : _c.readyState) < WebSocket.CLOSING // Close WebSocket if it is CONNECTING (0) or OPEN (1)
|
|
151
130
|
) {
|
|
152
131
|
this.realtime.reconnect = false;
|
|
153
132
|
this.realtime.socket.close();
|
|
@@ -181,7 +160,7 @@ class Client {
|
|
|
181
160
|
});
|
|
182
161
|
}
|
|
183
162
|
},
|
|
184
|
-
onMessage: (event) =>
|
|
163
|
+
onMessage: (event) => {
|
|
185
164
|
try {
|
|
186
165
|
const message = JSON.parse(event.data);
|
|
187
166
|
this.realtime.lastMessage = message;
|
|
@@ -208,7 +187,7 @@ class Client {
|
|
|
208
187
|
catch (e) {
|
|
209
188
|
console.error(e);
|
|
210
189
|
}
|
|
211
|
-
}
|
|
190
|
+
},
|
|
212
191
|
cleanUp: channels => {
|
|
213
192
|
this.realtime.channels.forEach(channel => {
|
|
214
193
|
if (channels.includes(channel)) {
|
|
@@ -300,6 +279,20 @@ class Client {
|
|
|
300
279
|
this.config.locale = value;
|
|
301
280
|
return this;
|
|
302
281
|
}
|
|
282
|
+
/**
|
|
283
|
+
* Set Session
|
|
284
|
+
*
|
|
285
|
+
* The user session to authenticate with
|
|
286
|
+
*
|
|
287
|
+
* @param value string
|
|
288
|
+
*
|
|
289
|
+
* @return {this}
|
|
290
|
+
*/
|
|
291
|
+
setSession(value) {
|
|
292
|
+
this.headers['X-Appwrite-Session'] = value;
|
|
293
|
+
this.config.session = value;
|
|
294
|
+
return this;
|
|
295
|
+
}
|
|
303
296
|
/**
|
|
304
297
|
* Subscribes to Appwrite events and passes you the payload in realtime.
|
|
305
298
|
*
|
|
@@ -392,6 +385,11 @@ class Client {
|
|
|
392
385
|
if (400 <= response.status) {
|
|
393
386
|
throw new AppwriteException(data === null || data === void 0 ? void 0 : data.message, response.status, data === null || data === void 0 ? void 0 : data.type, data);
|
|
394
387
|
}
|
|
388
|
+
const cookieFallback = response.headers.get('X-Fallback-Cookies');
|
|
389
|
+
if (typeof window !== 'undefined' && window.localStorage && cookieFallback) {
|
|
390
|
+
window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');
|
|
391
|
+
window.localStorage.setItem('cookieFallback', cookieFallback);
|
|
392
|
+
}
|
|
395
393
|
return data;
|
|
396
394
|
}
|
|
397
395
|
catch (e) {
|
|
@@ -519,7 +517,7 @@ class Account extends Service {
|
|
|
519
517
|
*
|
|
520
518
|
* Get the list of identities for the currently logged in user.
|
|
521
519
|
*
|
|
522
|
-
* @param {string} queries
|
|
520
|
+
* @param {string[]} queries
|
|
523
521
|
* @throws {AppwriteException}
|
|
524
522
|
* @returns {Promise}
|
|
525
523
|
*/
|
|
@@ -537,7 +535,7 @@ class Account extends Service {
|
|
|
537
535
|
});
|
|
538
536
|
}
|
|
539
537
|
/**
|
|
540
|
-
* Delete
|
|
538
|
+
* Delete identity
|
|
541
539
|
*
|
|
542
540
|
* Delete an identity by its unique ID.
|
|
543
541
|
*
|
|
@@ -603,6 +601,261 @@ class Account extends Service {
|
|
|
603
601
|
}, payload);
|
|
604
602
|
});
|
|
605
603
|
}
|
|
604
|
+
/**
|
|
605
|
+
* Update MFA
|
|
606
|
+
*
|
|
607
|
+
* Enable or disable MFA on an account.
|
|
608
|
+
*
|
|
609
|
+
* @param {boolean} mfa
|
|
610
|
+
* @throws {AppwriteException}
|
|
611
|
+
* @returns {Promise}
|
|
612
|
+
*/
|
|
613
|
+
updateMFA(mfa) {
|
|
614
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
615
|
+
if (typeof mfa === 'undefined') {
|
|
616
|
+
throw new AppwriteException('Missing required parameter: "mfa"');
|
|
617
|
+
}
|
|
618
|
+
const apiPath = '/account/mfa';
|
|
619
|
+
const payload = {};
|
|
620
|
+
if (typeof mfa !== 'undefined') {
|
|
621
|
+
payload['mfa'] = mfa;
|
|
622
|
+
}
|
|
623
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
624
|
+
return yield this.client.call('patch', uri, {
|
|
625
|
+
'content-type': 'application/json',
|
|
626
|
+
}, payload);
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Add Authenticator
|
|
631
|
+
*
|
|
632
|
+
* Add an authenticator app to be used as an MFA factor. Verify the
|
|
633
|
+
* authenticator using the [verify
|
|
634
|
+
* authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator)
|
|
635
|
+
* method.
|
|
636
|
+
*
|
|
637
|
+
* @param {AuthenticatorType} type
|
|
638
|
+
* @throws {AppwriteException}
|
|
639
|
+
* @returns {Promise}
|
|
640
|
+
*/
|
|
641
|
+
createMfaAuthenticator(type) {
|
|
642
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
643
|
+
if (typeof type === 'undefined') {
|
|
644
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
645
|
+
}
|
|
646
|
+
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
647
|
+
const payload = {};
|
|
648
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
649
|
+
return yield this.client.call('post', uri, {
|
|
650
|
+
'content-type': 'application/json',
|
|
651
|
+
}, payload);
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Verify Authenticator
|
|
656
|
+
*
|
|
657
|
+
* Verify an authenticator app after adding it using the [add
|
|
658
|
+
* authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
|
|
659
|
+
* method. add
|
|
660
|
+
*
|
|
661
|
+
* @param {AuthenticatorType} type
|
|
662
|
+
* @param {string} otp
|
|
663
|
+
* @throws {AppwriteException}
|
|
664
|
+
* @returns {Promise}
|
|
665
|
+
*/
|
|
666
|
+
updateMfaAuthenticator(type, otp) {
|
|
667
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
668
|
+
if (typeof type === 'undefined') {
|
|
669
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
670
|
+
}
|
|
671
|
+
if (typeof otp === 'undefined') {
|
|
672
|
+
throw new AppwriteException('Missing required parameter: "otp"');
|
|
673
|
+
}
|
|
674
|
+
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
675
|
+
const payload = {};
|
|
676
|
+
if (typeof otp !== 'undefined') {
|
|
677
|
+
payload['otp'] = otp;
|
|
678
|
+
}
|
|
679
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
680
|
+
return yield this.client.call('put', uri, {
|
|
681
|
+
'content-type': 'application/json',
|
|
682
|
+
}, payload);
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Delete Authenticator
|
|
687
|
+
*
|
|
688
|
+
* Delete an authenticator for a user by ID.
|
|
689
|
+
*
|
|
690
|
+
* @param {AuthenticatorType} type
|
|
691
|
+
* @param {string} otp
|
|
692
|
+
* @throws {AppwriteException}
|
|
693
|
+
* @returns {Promise}
|
|
694
|
+
*/
|
|
695
|
+
deleteMfaAuthenticator(type, otp) {
|
|
696
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
697
|
+
if (typeof type === 'undefined') {
|
|
698
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
699
|
+
}
|
|
700
|
+
if (typeof otp === 'undefined') {
|
|
701
|
+
throw new AppwriteException('Missing required parameter: "otp"');
|
|
702
|
+
}
|
|
703
|
+
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
704
|
+
const payload = {};
|
|
705
|
+
if (typeof otp !== 'undefined') {
|
|
706
|
+
payload['otp'] = otp;
|
|
707
|
+
}
|
|
708
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
709
|
+
return yield this.client.call('delete', uri, {
|
|
710
|
+
'content-type': 'application/json',
|
|
711
|
+
}, payload);
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* Create 2FA Challenge
|
|
716
|
+
*
|
|
717
|
+
* Begin the process of MFA verification after sign-in. Finish the flow with
|
|
718
|
+
* [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
|
|
719
|
+
* method.
|
|
720
|
+
*
|
|
721
|
+
* @param {AuthenticationFactor} factor
|
|
722
|
+
* @throws {AppwriteException}
|
|
723
|
+
* @returns {Promise}
|
|
724
|
+
*/
|
|
725
|
+
createMfaChallenge(factor) {
|
|
726
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
727
|
+
if (typeof factor === 'undefined') {
|
|
728
|
+
throw new AppwriteException('Missing required parameter: "factor"');
|
|
729
|
+
}
|
|
730
|
+
const apiPath = '/account/mfa/challenge';
|
|
731
|
+
const payload = {};
|
|
732
|
+
if (typeof factor !== 'undefined') {
|
|
733
|
+
payload['factor'] = factor;
|
|
734
|
+
}
|
|
735
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
736
|
+
return yield this.client.call('post', uri, {
|
|
737
|
+
'content-type': 'application/json',
|
|
738
|
+
}, payload);
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Create MFA Challenge (confirmation)
|
|
743
|
+
*
|
|
744
|
+
* Complete the MFA challenge by providing the one-time password. Finish the
|
|
745
|
+
* process of MFA verification by providing the one-time password. To begin
|
|
746
|
+
* the flow, use
|
|
747
|
+
* [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
|
|
748
|
+
* method.
|
|
749
|
+
*
|
|
750
|
+
* @param {string} challengeId
|
|
751
|
+
* @param {string} otp
|
|
752
|
+
* @throws {AppwriteException}
|
|
753
|
+
* @returns {Promise}
|
|
754
|
+
*/
|
|
755
|
+
updateMfaChallenge(challengeId, otp) {
|
|
756
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
757
|
+
if (typeof challengeId === 'undefined') {
|
|
758
|
+
throw new AppwriteException('Missing required parameter: "challengeId"');
|
|
759
|
+
}
|
|
760
|
+
if (typeof otp === 'undefined') {
|
|
761
|
+
throw new AppwriteException('Missing required parameter: "otp"');
|
|
762
|
+
}
|
|
763
|
+
const apiPath = '/account/mfa/challenge';
|
|
764
|
+
const payload = {};
|
|
765
|
+
if (typeof challengeId !== 'undefined') {
|
|
766
|
+
payload['challengeId'] = challengeId;
|
|
767
|
+
}
|
|
768
|
+
if (typeof otp !== 'undefined') {
|
|
769
|
+
payload['otp'] = otp;
|
|
770
|
+
}
|
|
771
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
772
|
+
return yield this.client.call('put', uri, {
|
|
773
|
+
'content-type': 'application/json',
|
|
774
|
+
}, payload);
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* List Factors
|
|
779
|
+
*
|
|
780
|
+
* List the factors available on the account to be used as a MFA challange.
|
|
781
|
+
*
|
|
782
|
+
* @throws {AppwriteException}
|
|
783
|
+
* @returns {Promise}
|
|
784
|
+
*/
|
|
785
|
+
listMfaFactors() {
|
|
786
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
787
|
+
const apiPath = '/account/mfa/factors';
|
|
788
|
+
const payload = {};
|
|
789
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
790
|
+
return yield this.client.call('get', uri, {
|
|
791
|
+
'content-type': 'application/json',
|
|
792
|
+
}, payload);
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Get MFA Recovery Codes
|
|
797
|
+
*
|
|
798
|
+
* Get recovery codes that can be used as backup for MFA flow. Before getting
|
|
799
|
+
* codes, they must be generated using
|
|
800
|
+
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
|
|
801
|
+
* method. An OTP challenge is required to read recovery codes.
|
|
802
|
+
*
|
|
803
|
+
* @throws {AppwriteException}
|
|
804
|
+
* @returns {Promise}
|
|
805
|
+
*/
|
|
806
|
+
getMfaRecoveryCodes() {
|
|
807
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
808
|
+
const apiPath = '/account/mfa/recovery-codes';
|
|
809
|
+
const payload = {};
|
|
810
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
811
|
+
return yield this.client.call('get', uri, {
|
|
812
|
+
'content-type': 'application/json',
|
|
813
|
+
}, payload);
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Create MFA Recovery Codes
|
|
818
|
+
*
|
|
819
|
+
* Generate recovery codes as backup for MFA flow. It's recommended to
|
|
820
|
+
* generate and show then immediately after user successfully adds their
|
|
821
|
+
* authehticator. Recovery codes can be used as a MFA verification type in
|
|
822
|
+
* [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
|
|
823
|
+
* method.
|
|
824
|
+
*
|
|
825
|
+
* @throws {AppwriteException}
|
|
826
|
+
* @returns {Promise}
|
|
827
|
+
*/
|
|
828
|
+
createMfaRecoveryCodes() {
|
|
829
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
830
|
+
const apiPath = '/account/mfa/recovery-codes';
|
|
831
|
+
const payload = {};
|
|
832
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
833
|
+
return yield this.client.call('post', uri, {
|
|
834
|
+
'content-type': 'application/json',
|
|
835
|
+
}, payload);
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Regenerate MFA Recovery Codes
|
|
840
|
+
*
|
|
841
|
+
* Regenerate recovery codes that can be used as backup for MFA flow. Before
|
|
842
|
+
* regenerating codes, they must be first generated using
|
|
843
|
+
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
|
|
844
|
+
* method. An OTP challenge is required to regenreate recovery codes.
|
|
845
|
+
*
|
|
846
|
+
* @throws {AppwriteException}
|
|
847
|
+
* @returns {Promise}
|
|
848
|
+
*/
|
|
849
|
+
updateMfaRecoveryCodes() {
|
|
850
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
851
|
+
const apiPath = '/account/mfa/recovery-codes';
|
|
852
|
+
const payload = {};
|
|
853
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
854
|
+
return yield this.client.call('patch', uri, {
|
|
855
|
+
'content-type': 'application/json',
|
|
856
|
+
}, payload);
|
|
857
|
+
});
|
|
858
|
+
}
|
|
606
859
|
/**
|
|
607
860
|
* Update name
|
|
608
861
|
*
|
|
@@ -720,7 +973,7 @@ class Account extends Service {
|
|
|
720
973
|
* stored as is, and replaces any previous value. The maximum allowed prefs
|
|
721
974
|
* size is 64kB and throws error if exceeded.
|
|
722
975
|
*
|
|
723
|
-
* @param {
|
|
976
|
+
* @param {object} prefs
|
|
724
977
|
* @throws {AppwriteException}
|
|
725
978
|
* @returns {Promise}
|
|
726
979
|
*/
|
|
@@ -796,11 +1049,10 @@ class Account extends Service {
|
|
|
796
1049
|
* @param {string} userId
|
|
797
1050
|
* @param {string} secret
|
|
798
1051
|
* @param {string} password
|
|
799
|
-
* @param {string} passwordAgain
|
|
800
1052
|
* @throws {AppwriteException}
|
|
801
1053
|
* @returns {Promise}
|
|
802
1054
|
*/
|
|
803
|
-
updateRecovery(userId, secret, password
|
|
1055
|
+
updateRecovery(userId, secret, password) {
|
|
804
1056
|
return __awaiter(this, void 0, void 0, function* () {
|
|
805
1057
|
if (typeof userId === 'undefined') {
|
|
806
1058
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -811,9 +1063,6 @@ class Account extends Service {
|
|
|
811
1063
|
if (typeof password === 'undefined') {
|
|
812
1064
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
813
1065
|
}
|
|
814
|
-
if (typeof passwordAgain === 'undefined') {
|
|
815
|
-
throw new AppwriteException('Missing required parameter: "passwordAgain"');
|
|
816
|
-
}
|
|
817
1066
|
const apiPath = '/account/recovery';
|
|
818
1067
|
const payload = {};
|
|
819
1068
|
if (typeof userId !== 'undefined') {
|
|
@@ -825,9 +1074,6 @@ class Account extends Service {
|
|
|
825
1074
|
if (typeof password !== 'undefined') {
|
|
826
1075
|
payload['password'] = password;
|
|
827
1076
|
}
|
|
828
|
-
if (typeof passwordAgain !== 'undefined') {
|
|
829
|
-
payload['passwordAgain'] = passwordAgain;
|
|
830
|
-
}
|
|
831
1077
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
832
1078
|
return yield this.client.call('put', uri, {
|
|
833
1079
|
'content-type': 'application/json',
|
|
@@ -897,7 +1143,7 @@ class Account extends Service {
|
|
|
897
1143
|
});
|
|
898
1144
|
}
|
|
899
1145
|
/**
|
|
900
|
-
* Create email session
|
|
1146
|
+
* Create email password session
|
|
901
1147
|
*
|
|
902
1148
|
* Allow the user to login into their account by providing a valid email and
|
|
903
1149
|
* password combination. This route will create a new session for the user.
|
|
@@ -907,25 +1153,398 @@ class Account extends Service {
|
|
|
907
1153
|
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
908
1154
|
*
|
|
909
1155
|
* @param {string} email
|
|
910
|
-
* @param {string} password
|
|
1156
|
+
* @param {string} password
|
|
1157
|
+
* @throws {AppwriteException}
|
|
1158
|
+
* @returns {Promise}
|
|
1159
|
+
*/
|
|
1160
|
+
createEmailPasswordSession(email, password) {
|
|
1161
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1162
|
+
if (typeof email === 'undefined') {
|
|
1163
|
+
throw new AppwriteException('Missing required parameter: "email"');
|
|
1164
|
+
}
|
|
1165
|
+
if (typeof password === 'undefined') {
|
|
1166
|
+
throw new AppwriteException('Missing required parameter: "password"');
|
|
1167
|
+
}
|
|
1168
|
+
const apiPath = '/account/sessions/email';
|
|
1169
|
+
const payload = {};
|
|
1170
|
+
if (typeof email !== 'undefined') {
|
|
1171
|
+
payload['email'] = email;
|
|
1172
|
+
}
|
|
1173
|
+
if (typeof password !== 'undefined') {
|
|
1174
|
+
payload['password'] = password;
|
|
1175
|
+
}
|
|
1176
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1177
|
+
return yield this.client.call('post', uri, {
|
|
1178
|
+
'content-type': 'application/json',
|
|
1179
|
+
}, payload);
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
/**
|
|
1183
|
+
* Update magic URL session
|
|
1184
|
+
*
|
|
1185
|
+
* Use this endpoint to create a session from token. Provide the **userId**
|
|
1186
|
+
* and **secret** parameters from the successful response of authentication
|
|
1187
|
+
* flows initiated by token creation. For example, magic URL and phone login.
|
|
1188
|
+
*
|
|
1189
|
+
* @param {string} userId
|
|
1190
|
+
* @param {string} secret
|
|
1191
|
+
* @throws {AppwriteException}
|
|
1192
|
+
* @returns {Promise}
|
|
1193
|
+
*/
|
|
1194
|
+
updateMagicURLSession(userId, secret) {
|
|
1195
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1196
|
+
if (typeof userId === 'undefined') {
|
|
1197
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1198
|
+
}
|
|
1199
|
+
if (typeof secret === 'undefined') {
|
|
1200
|
+
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1201
|
+
}
|
|
1202
|
+
const apiPath = '/account/sessions/magic-url';
|
|
1203
|
+
const payload = {};
|
|
1204
|
+
if (typeof userId !== 'undefined') {
|
|
1205
|
+
payload['userId'] = userId;
|
|
1206
|
+
}
|
|
1207
|
+
if (typeof secret !== 'undefined') {
|
|
1208
|
+
payload['secret'] = secret;
|
|
1209
|
+
}
|
|
1210
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1211
|
+
return yield this.client.call('put', uri, {
|
|
1212
|
+
'content-type': 'application/json',
|
|
1213
|
+
}, payload);
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
/**
|
|
1217
|
+
* Create OAuth2 session
|
|
1218
|
+
*
|
|
1219
|
+
* Allow the user to login to their account using the OAuth2 provider of their
|
|
1220
|
+
* choice. Each OAuth2 provider should be enabled from the Appwrite console
|
|
1221
|
+
* first. Use the success and failure arguments to provide a redirect URL's
|
|
1222
|
+
* back to your app when login is completed.
|
|
1223
|
+
*
|
|
1224
|
+
* If there is already an active session, the new session will be attached to
|
|
1225
|
+
* the logged-in account. If there are no active sessions, the server will
|
|
1226
|
+
* attempt to look for a user with the same email address as the email
|
|
1227
|
+
* received from the OAuth2 provider and attach the new session to the
|
|
1228
|
+
* existing user. If no matching user is found - the server will create a new
|
|
1229
|
+
* user.
|
|
1230
|
+
*
|
|
1231
|
+
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
1232
|
+
* about session
|
|
1233
|
+
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1234
|
+
*
|
|
1235
|
+
*
|
|
1236
|
+
* @param {OAuthProvider} provider
|
|
1237
|
+
* @param {string} success
|
|
1238
|
+
* @param {string} failure
|
|
1239
|
+
* @param {string[]} scopes
|
|
1240
|
+
* @throws {AppwriteException}
|
|
1241
|
+
* @returns {void|string}
|
|
1242
|
+
*/
|
|
1243
|
+
createOAuth2Session(provider, success, failure, scopes) {
|
|
1244
|
+
if (typeof provider === 'undefined') {
|
|
1245
|
+
throw new AppwriteException('Missing required parameter: "provider"');
|
|
1246
|
+
}
|
|
1247
|
+
const apiPath = '/account/sessions/oauth2/{provider}'.replace('{provider}', provider);
|
|
1248
|
+
const payload = {};
|
|
1249
|
+
if (typeof success !== 'undefined') {
|
|
1250
|
+
payload['success'] = success;
|
|
1251
|
+
}
|
|
1252
|
+
if (typeof failure !== 'undefined') {
|
|
1253
|
+
payload['failure'] = failure;
|
|
1254
|
+
}
|
|
1255
|
+
if (typeof scopes !== 'undefined') {
|
|
1256
|
+
payload['scopes'] = scopes;
|
|
1257
|
+
}
|
|
1258
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1259
|
+
payload['project'] = this.client.config.project;
|
|
1260
|
+
for (const [key, value] of Object.entries(Service.flatten(payload))) {
|
|
1261
|
+
uri.searchParams.append(key, value);
|
|
1262
|
+
}
|
|
1263
|
+
return uri;
|
|
1264
|
+
}
|
|
1265
|
+
/**
|
|
1266
|
+
* Update phone session
|
|
1267
|
+
*
|
|
1268
|
+
* Use this endpoint to create a session from token. Provide the **userId**
|
|
1269
|
+
* and **secret** parameters from the successful response of authentication
|
|
1270
|
+
* flows initiated by token creation. For example, magic URL and phone login.
|
|
1271
|
+
*
|
|
1272
|
+
* @param {string} userId
|
|
1273
|
+
* @param {string} secret
|
|
1274
|
+
* @throws {AppwriteException}
|
|
1275
|
+
* @returns {Promise}
|
|
1276
|
+
*/
|
|
1277
|
+
updatePhoneSession(userId, secret) {
|
|
1278
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1279
|
+
if (typeof userId === 'undefined') {
|
|
1280
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1281
|
+
}
|
|
1282
|
+
if (typeof secret === 'undefined') {
|
|
1283
|
+
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1284
|
+
}
|
|
1285
|
+
const apiPath = '/account/sessions/phone';
|
|
1286
|
+
const payload = {};
|
|
1287
|
+
if (typeof userId !== 'undefined') {
|
|
1288
|
+
payload['userId'] = userId;
|
|
1289
|
+
}
|
|
1290
|
+
if (typeof secret !== 'undefined') {
|
|
1291
|
+
payload['secret'] = secret;
|
|
1292
|
+
}
|
|
1293
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1294
|
+
return yield this.client.call('put', uri, {
|
|
1295
|
+
'content-type': 'application/json',
|
|
1296
|
+
}, payload);
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
/**
|
|
1300
|
+
* Create session
|
|
1301
|
+
*
|
|
1302
|
+
* Use this endpoint to create a session from token. Provide the **userId**
|
|
1303
|
+
* and **secret** parameters from the successful response of authentication
|
|
1304
|
+
* flows initiated by token creation. For example, magic URL and phone login.
|
|
1305
|
+
*
|
|
1306
|
+
* @param {string} userId
|
|
1307
|
+
* @param {string} secret
|
|
1308
|
+
* @throws {AppwriteException}
|
|
1309
|
+
* @returns {Promise}
|
|
1310
|
+
*/
|
|
1311
|
+
createSession(userId, secret) {
|
|
1312
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1313
|
+
if (typeof userId === 'undefined') {
|
|
1314
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1315
|
+
}
|
|
1316
|
+
if (typeof secret === 'undefined') {
|
|
1317
|
+
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1318
|
+
}
|
|
1319
|
+
const apiPath = '/account/sessions/token';
|
|
1320
|
+
const payload = {};
|
|
1321
|
+
if (typeof userId !== 'undefined') {
|
|
1322
|
+
payload['userId'] = userId;
|
|
1323
|
+
}
|
|
1324
|
+
if (typeof secret !== 'undefined') {
|
|
1325
|
+
payload['secret'] = secret;
|
|
1326
|
+
}
|
|
1327
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1328
|
+
return yield this.client.call('post', uri, {
|
|
1329
|
+
'content-type': 'application/json',
|
|
1330
|
+
}, payload);
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Get session
|
|
1335
|
+
*
|
|
1336
|
+
* Use this endpoint to get a logged in user's session using a Session ID.
|
|
1337
|
+
* Inputting 'current' will return the current session being used.
|
|
1338
|
+
*
|
|
1339
|
+
* @param {string} sessionId
|
|
1340
|
+
* @throws {AppwriteException}
|
|
1341
|
+
* @returns {Promise}
|
|
1342
|
+
*/
|
|
1343
|
+
getSession(sessionId) {
|
|
1344
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1345
|
+
if (typeof sessionId === 'undefined') {
|
|
1346
|
+
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1347
|
+
}
|
|
1348
|
+
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
1349
|
+
const payload = {};
|
|
1350
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1351
|
+
return yield this.client.call('get', uri, {
|
|
1352
|
+
'content-type': 'application/json',
|
|
1353
|
+
}, payload);
|
|
1354
|
+
});
|
|
1355
|
+
}
|
|
1356
|
+
/**
|
|
1357
|
+
* Update session
|
|
1358
|
+
*
|
|
1359
|
+
* Use this endpoint to extend a session's length. Extending a session is
|
|
1360
|
+
* useful when session expiry is short. If the session was created using an
|
|
1361
|
+
* OAuth provider, this endpoint refreshes the access token from the provider.
|
|
1362
|
+
*
|
|
1363
|
+
* @param {string} sessionId
|
|
1364
|
+
* @throws {AppwriteException}
|
|
1365
|
+
* @returns {Promise}
|
|
1366
|
+
*/
|
|
1367
|
+
updateSession(sessionId) {
|
|
1368
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1369
|
+
if (typeof sessionId === 'undefined') {
|
|
1370
|
+
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1371
|
+
}
|
|
1372
|
+
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
1373
|
+
const payload = {};
|
|
1374
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1375
|
+
return yield this.client.call('patch', uri, {
|
|
1376
|
+
'content-type': 'application/json',
|
|
1377
|
+
}, payload);
|
|
1378
|
+
});
|
|
1379
|
+
}
|
|
1380
|
+
/**
|
|
1381
|
+
* Delete session
|
|
1382
|
+
*
|
|
1383
|
+
* Logout the user. Use 'current' as the session ID to logout on this device,
|
|
1384
|
+
* use a session ID to logout on another device. If you're looking to logout
|
|
1385
|
+
* the user on all devices, use [Delete
|
|
1386
|
+
* Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions)
|
|
1387
|
+
* instead.
|
|
1388
|
+
*
|
|
1389
|
+
* @param {string} sessionId
|
|
1390
|
+
* @throws {AppwriteException}
|
|
1391
|
+
* @returns {Promise}
|
|
1392
|
+
*/
|
|
1393
|
+
deleteSession(sessionId) {
|
|
1394
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1395
|
+
if (typeof sessionId === 'undefined') {
|
|
1396
|
+
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1397
|
+
}
|
|
1398
|
+
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
1399
|
+
const payload = {};
|
|
1400
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1401
|
+
return yield this.client.call('delete', uri, {
|
|
1402
|
+
'content-type': 'application/json',
|
|
1403
|
+
}, payload);
|
|
1404
|
+
});
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* Update status
|
|
1408
|
+
*
|
|
1409
|
+
* Block the currently logged in user account. Behind the scene, the user
|
|
1410
|
+
* record is not deleted but permanently blocked from any access. To
|
|
1411
|
+
* completely delete a user, use the Users API instead.
|
|
1412
|
+
*
|
|
1413
|
+
* @throws {AppwriteException}
|
|
1414
|
+
* @returns {Promise}
|
|
1415
|
+
*/
|
|
1416
|
+
updateStatus() {
|
|
1417
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1418
|
+
const apiPath = '/account/status';
|
|
1419
|
+
const payload = {};
|
|
1420
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1421
|
+
return yield this.client.call('patch', uri, {
|
|
1422
|
+
'content-type': 'application/json',
|
|
1423
|
+
}, payload);
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
/**
|
|
1427
|
+
* Create push target
|
|
1428
|
+
*
|
|
1429
|
+
*
|
|
1430
|
+
* @param {string} targetId
|
|
1431
|
+
* @param {string} identifier
|
|
1432
|
+
* @param {string} providerId
|
|
1433
|
+
* @throws {AppwriteException}
|
|
1434
|
+
* @returns {Promise}
|
|
1435
|
+
*/
|
|
1436
|
+
createPushTarget(targetId, identifier, providerId) {
|
|
1437
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1438
|
+
if (typeof targetId === 'undefined') {
|
|
1439
|
+
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1440
|
+
}
|
|
1441
|
+
if (typeof identifier === 'undefined') {
|
|
1442
|
+
throw new AppwriteException('Missing required parameter: "identifier"');
|
|
1443
|
+
}
|
|
1444
|
+
const apiPath = '/account/targets/push';
|
|
1445
|
+
const payload = {};
|
|
1446
|
+
if (typeof targetId !== 'undefined') {
|
|
1447
|
+
payload['targetId'] = targetId;
|
|
1448
|
+
}
|
|
1449
|
+
if (typeof identifier !== 'undefined') {
|
|
1450
|
+
payload['identifier'] = identifier;
|
|
1451
|
+
}
|
|
1452
|
+
if (typeof providerId !== 'undefined') {
|
|
1453
|
+
payload['providerId'] = providerId;
|
|
1454
|
+
}
|
|
1455
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1456
|
+
return yield this.client.call('post', uri, {
|
|
1457
|
+
'content-type': 'application/json',
|
|
1458
|
+
}, payload);
|
|
1459
|
+
});
|
|
1460
|
+
}
|
|
1461
|
+
/**
|
|
1462
|
+
* Update push target
|
|
1463
|
+
*
|
|
1464
|
+
*
|
|
1465
|
+
* @param {string} targetId
|
|
1466
|
+
* @param {string} identifier
|
|
1467
|
+
* @throws {AppwriteException}
|
|
1468
|
+
* @returns {Promise}
|
|
1469
|
+
*/
|
|
1470
|
+
updatePushTarget(targetId, identifier) {
|
|
1471
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1472
|
+
if (typeof targetId === 'undefined') {
|
|
1473
|
+
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1474
|
+
}
|
|
1475
|
+
if (typeof identifier === 'undefined') {
|
|
1476
|
+
throw new AppwriteException('Missing required parameter: "identifier"');
|
|
1477
|
+
}
|
|
1478
|
+
const apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId);
|
|
1479
|
+
const payload = {};
|
|
1480
|
+
if (typeof identifier !== 'undefined') {
|
|
1481
|
+
payload['identifier'] = identifier;
|
|
1482
|
+
}
|
|
1483
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1484
|
+
return yield this.client.call('put', uri, {
|
|
1485
|
+
'content-type': 'application/json',
|
|
1486
|
+
}, payload);
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
/**
|
|
1490
|
+
* Delete push target
|
|
1491
|
+
*
|
|
1492
|
+
*
|
|
1493
|
+
* @param {string} targetId
|
|
1494
|
+
* @throws {AppwriteException}
|
|
1495
|
+
* @returns {Promise}
|
|
1496
|
+
*/
|
|
1497
|
+
deletePushTarget(targetId) {
|
|
1498
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1499
|
+
if (typeof targetId === 'undefined') {
|
|
1500
|
+
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1501
|
+
}
|
|
1502
|
+
const apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId);
|
|
1503
|
+
const payload = {};
|
|
1504
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1505
|
+
return yield this.client.call('delete', uri, {
|
|
1506
|
+
'content-type': 'application/json',
|
|
1507
|
+
}, payload);
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
/**
|
|
1511
|
+
* Create email token (OTP)
|
|
1512
|
+
*
|
|
1513
|
+
* Sends the user an email with a secret key for creating a session. If the
|
|
1514
|
+
* provided user ID has not be registered, a new user will be created. Use the
|
|
1515
|
+
* returned user ID and secret and submit a request to the [POST
|
|
1516
|
+
* /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
|
1517
|
+
* endpoint to complete the login process. The secret sent to the user's email
|
|
1518
|
+
* is valid for 15 minutes.
|
|
1519
|
+
*
|
|
1520
|
+
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
1521
|
+
* about session
|
|
1522
|
+
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1523
|
+
*
|
|
1524
|
+
* @param {string} userId
|
|
1525
|
+
* @param {string} email
|
|
1526
|
+
* @param {boolean} phrase
|
|
911
1527
|
* @throws {AppwriteException}
|
|
912
1528
|
* @returns {Promise}
|
|
913
1529
|
*/
|
|
914
|
-
|
|
1530
|
+
createEmailToken(userId, email, phrase) {
|
|
915
1531
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1532
|
+
if (typeof userId === 'undefined') {
|
|
1533
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1534
|
+
}
|
|
916
1535
|
if (typeof email === 'undefined') {
|
|
917
1536
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
918
1537
|
}
|
|
919
|
-
|
|
920
|
-
throw new AppwriteException('Missing required parameter: "password"');
|
|
921
|
-
}
|
|
922
|
-
const apiPath = '/account/sessions/email';
|
|
1538
|
+
const apiPath = '/account/tokens/email';
|
|
923
1539
|
const payload = {};
|
|
1540
|
+
if (typeof userId !== 'undefined') {
|
|
1541
|
+
payload['userId'] = userId;
|
|
1542
|
+
}
|
|
924
1543
|
if (typeof email !== 'undefined') {
|
|
925
1544
|
payload['email'] = email;
|
|
926
1545
|
}
|
|
927
|
-
if (typeof
|
|
928
|
-
payload['
|
|
1546
|
+
if (typeof phrase !== 'undefined') {
|
|
1547
|
+
payload['phrase'] = phrase;
|
|
929
1548
|
}
|
|
930
1549
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
931
1550
|
return yield this.client.call('post', uri, {
|
|
@@ -934,15 +1553,15 @@ class Account extends Service {
|
|
|
934
1553
|
});
|
|
935
1554
|
}
|
|
936
1555
|
/**
|
|
937
|
-
* Create magic URL
|
|
1556
|
+
* Create magic URL token
|
|
938
1557
|
*
|
|
939
1558
|
* Sends the user an email with a secret key for creating a session. If the
|
|
940
1559
|
* provided user ID has not been registered, a new user will be created. When
|
|
941
1560
|
* the user clicks the link in the email, the user is redirected back to the
|
|
942
1561
|
* URL you provided with the secret key and userId values attached to the URL
|
|
943
1562
|
* query string. Use the query string parameters to submit a request to the
|
|
944
|
-
* [
|
|
945
|
-
* /account/sessions/
|
|
1563
|
+
* [POST
|
|
1564
|
+
* /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
|
946
1565
|
* endpoint to complete the login process. The link sent to the user's email
|
|
947
1566
|
* address is valid for 1 hour. If you are on a mobile device you can leave
|
|
948
1567
|
* the URL parameter empty, so that the login completion will be handled by
|
|
@@ -956,10 +1575,11 @@ class Account extends Service {
|
|
|
956
1575
|
* @param {string} userId
|
|
957
1576
|
* @param {string} email
|
|
958
1577
|
* @param {string} url
|
|
1578
|
+
* @param {boolean} phrase
|
|
959
1579
|
* @throws {AppwriteException}
|
|
960
1580
|
* @returns {Promise}
|
|
961
1581
|
*/
|
|
962
|
-
|
|
1582
|
+
createMagicURLToken(userId, email, url, phrase) {
|
|
963
1583
|
return __awaiter(this, void 0, void 0, function* () {
|
|
964
1584
|
if (typeof userId === 'undefined') {
|
|
965
1585
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -967,7 +1587,7 @@ class Account extends Service {
|
|
|
967
1587
|
if (typeof email === 'undefined') {
|
|
968
1588
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
969
1589
|
}
|
|
970
|
-
const apiPath = '/account/
|
|
1590
|
+
const apiPath = '/account/tokens/magic-url';
|
|
971
1591
|
const payload = {};
|
|
972
1592
|
if (typeof userId !== 'undefined') {
|
|
973
1593
|
payload['userId'] = userId;
|
|
@@ -978,91 +1598,69 @@ class Account extends Service {
|
|
|
978
1598
|
if (typeof url !== 'undefined') {
|
|
979
1599
|
payload['url'] = url;
|
|
980
1600
|
}
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
'content-type': 'application/json',
|
|
984
|
-
}, payload);
|
|
985
|
-
});
|
|
986
|
-
}
|
|
987
|
-
/**
|
|
988
|
-
* Create magic URL session (confirmation)
|
|
989
|
-
*
|
|
990
|
-
* Use this endpoint to complete creating the session with the Magic URL. Both
|
|
991
|
-
* the **userId** and **secret** arguments will be passed as query parameters
|
|
992
|
-
* to the redirect URL you have provided when sending your request to the
|
|
993
|
-
* [POST
|
|
994
|
-
* /account/sessions/magic-url](https://appwrite.io/docs/references/cloud/client-web/account#createMagicURLSession)
|
|
995
|
-
* endpoint.
|
|
996
|
-
*
|
|
997
|
-
* Please note that in order to avoid a [Redirect
|
|
998
|
-
* Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
|
999
|
-
* the only valid redirect URLs are the ones from domains you have set when
|
|
1000
|
-
* adding your platforms in the console interface.
|
|
1001
|
-
*
|
|
1002
|
-
* @param {string} userId
|
|
1003
|
-
* @param {string} secret
|
|
1004
|
-
* @throws {AppwriteException}
|
|
1005
|
-
* @returns {Promise}
|
|
1006
|
-
*/
|
|
1007
|
-
updateMagicURLSession(userId, secret) {
|
|
1008
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1009
|
-
if (typeof userId === 'undefined') {
|
|
1010
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1011
|
-
}
|
|
1012
|
-
if (typeof secret === 'undefined') {
|
|
1013
|
-
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1014
|
-
}
|
|
1015
|
-
const apiPath = '/account/sessions/magic-url';
|
|
1016
|
-
const payload = {};
|
|
1017
|
-
if (typeof userId !== 'undefined') {
|
|
1018
|
-
payload['userId'] = userId;
|
|
1019
|
-
}
|
|
1020
|
-
if (typeof secret !== 'undefined') {
|
|
1021
|
-
payload['secret'] = secret;
|
|
1601
|
+
if (typeof phrase !== 'undefined') {
|
|
1602
|
+
payload['phrase'] = phrase;
|
|
1022
1603
|
}
|
|
1023
1604
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1024
|
-
return yield this.client.call('
|
|
1605
|
+
return yield this.client.call('post', uri, {
|
|
1025
1606
|
'content-type': 'application/json',
|
|
1026
1607
|
}, payload);
|
|
1027
1608
|
});
|
|
1028
1609
|
}
|
|
1029
1610
|
/**
|
|
1030
|
-
* Create OAuth2
|
|
1611
|
+
* Create OAuth2 token
|
|
1031
1612
|
*
|
|
1032
1613
|
* Allow the user to login to their account using the OAuth2 provider of their
|
|
1033
1614
|
* choice. Each OAuth2 provider should be enabled from the Appwrite console
|
|
1034
1615
|
* first. Use the success and failure arguments to provide a redirect URL's
|
|
1035
1616
|
* back to your app when login is completed.
|
|
1036
1617
|
*
|
|
1037
|
-
* If
|
|
1038
|
-
* the
|
|
1039
|
-
*
|
|
1040
|
-
*
|
|
1041
|
-
*
|
|
1042
|
-
* user.
|
|
1618
|
+
* If authentication succeeds, `userId` and `secret` of a token will be
|
|
1619
|
+
* appended to the success URL as query parameters. These can be used to
|
|
1620
|
+
* create a new session using the [Create
|
|
1621
|
+
* session](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
|
1622
|
+
* endpoint.
|
|
1043
1623
|
*
|
|
1044
1624
|
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
1045
1625
|
* about session
|
|
1046
1626
|
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1047
1627
|
*
|
|
1048
|
-
*
|
|
1049
|
-
* @param {string} provider
|
|
1628
|
+
* @param {OAuthProvider} provider
|
|
1050
1629
|
* @param {string} success
|
|
1051
1630
|
* @param {string} failure
|
|
1052
1631
|
* @param {string[]} scopes
|
|
1053
1632
|
* @throws {AppwriteException}
|
|
1054
1633
|
* @returns {void|string}
|
|
1055
1634
|
*/
|
|
1056
|
-
|
|
1057
|
-
|
|
1635
|
+
createOAuth2Token(provider, success, failure, scopes) {
|
|
1636
|
+
if (typeof provider === 'undefined') {
|
|
1637
|
+
throw new AppwriteException('Missing required parameter: "provider"');
|
|
1638
|
+
}
|
|
1639
|
+
const apiPath = '/account/tokens/oauth2/{provider}'.replace('{provider}', provider);
|
|
1640
|
+
const payload = {};
|
|
1641
|
+
if (typeof success !== 'undefined') {
|
|
1642
|
+
payload['success'] = success;
|
|
1643
|
+
}
|
|
1644
|
+
if (typeof failure !== 'undefined') {
|
|
1645
|
+
payload['failure'] = failure;
|
|
1646
|
+
}
|
|
1647
|
+
if (typeof scopes !== 'undefined') {
|
|
1648
|
+
payload['scopes'] = scopes;
|
|
1649
|
+
}
|
|
1650
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1651
|
+
payload['project'] = this.client.config.project;
|
|
1652
|
+
for (const [key, value] of Object.entries(Service.flatten(payload))) {
|
|
1653
|
+
uri.searchParams.append(key, value);
|
|
1654
|
+
}
|
|
1655
|
+
return uri;
|
|
1058
1656
|
}
|
|
1059
1657
|
/**
|
|
1060
|
-
* Create phone
|
|
1658
|
+
* Create phone token
|
|
1061
1659
|
*
|
|
1062
1660
|
* Sends the user an SMS with a secret key for creating a session. If the
|
|
1063
1661
|
* provided user ID has not be registered, a new user will be created. Use the
|
|
1064
|
-
* returned user ID and secret and submit a request to the [
|
|
1065
|
-
* /account/sessions/
|
|
1662
|
+
* returned user ID and secret and submit a request to the [POST
|
|
1663
|
+
* /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
|
1066
1664
|
* endpoint to complete the login process. The secret sent to the user's phone
|
|
1067
1665
|
* is valid for 15 minutes.
|
|
1068
1666
|
*
|
|
@@ -1075,7 +1673,7 @@ class Account extends Service {
|
|
|
1075
1673
|
* @throws {AppwriteException}
|
|
1076
1674
|
* @returns {Promise}
|
|
1077
1675
|
*/
|
|
1078
|
-
|
|
1676
|
+
createPhoneToken(userId, phone) {
|
|
1079
1677
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1080
1678
|
if (typeof userId === 'undefined') {
|
|
1081
1679
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -1083,7 +1681,7 @@ class Account extends Service {
|
|
|
1083
1681
|
if (typeof phone === 'undefined') {
|
|
1084
1682
|
throw new AppwriteException('Missing required parameter: "phone"');
|
|
1085
1683
|
}
|
|
1086
|
-
const apiPath = '/account/
|
|
1684
|
+
const apiPath = '/account/tokens/phone';
|
|
1087
1685
|
const payload = {};
|
|
1088
1686
|
if (typeof userId !== 'undefined') {
|
|
1089
1687
|
payload['userId'] = userId;
|
|
@@ -1097,135 +1695,6 @@ class Account extends Service {
|
|
|
1097
1695
|
}, payload);
|
|
1098
1696
|
});
|
|
1099
1697
|
}
|
|
1100
|
-
/**
|
|
1101
|
-
* Create phone session (confirmation)
|
|
1102
|
-
*
|
|
1103
|
-
* Use this endpoint to complete creating a session with SMS. Use the
|
|
1104
|
-
* **userId** from the
|
|
1105
|
-
* [createPhoneSession](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneSession)
|
|
1106
|
-
* endpoint and the **secret** received via SMS to successfully update and
|
|
1107
|
-
* confirm the phone session.
|
|
1108
|
-
*
|
|
1109
|
-
* @param {string} userId
|
|
1110
|
-
* @param {string} secret
|
|
1111
|
-
* @throws {AppwriteException}
|
|
1112
|
-
* @returns {Promise}
|
|
1113
|
-
*/
|
|
1114
|
-
updatePhoneSession(userId, secret) {
|
|
1115
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1116
|
-
if (typeof userId === 'undefined') {
|
|
1117
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1118
|
-
}
|
|
1119
|
-
if (typeof secret === 'undefined') {
|
|
1120
|
-
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1121
|
-
}
|
|
1122
|
-
const apiPath = '/account/sessions/phone';
|
|
1123
|
-
const payload = {};
|
|
1124
|
-
if (typeof userId !== 'undefined') {
|
|
1125
|
-
payload['userId'] = userId;
|
|
1126
|
-
}
|
|
1127
|
-
if (typeof secret !== 'undefined') {
|
|
1128
|
-
payload['secret'] = secret;
|
|
1129
|
-
}
|
|
1130
|
-
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1131
|
-
return yield this.client.call('put', uri, {
|
|
1132
|
-
'content-type': 'application/json',
|
|
1133
|
-
}, payload);
|
|
1134
|
-
});
|
|
1135
|
-
}
|
|
1136
|
-
/**
|
|
1137
|
-
* Get session
|
|
1138
|
-
*
|
|
1139
|
-
* Use this endpoint to get a logged in user's session using a Session ID.
|
|
1140
|
-
* Inputting 'current' will return the current session being used.
|
|
1141
|
-
*
|
|
1142
|
-
* @param {string} sessionId
|
|
1143
|
-
* @throws {AppwriteException}
|
|
1144
|
-
* @returns {Promise}
|
|
1145
|
-
*/
|
|
1146
|
-
getSession(sessionId) {
|
|
1147
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1148
|
-
if (typeof sessionId === 'undefined') {
|
|
1149
|
-
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1150
|
-
}
|
|
1151
|
-
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
1152
|
-
const payload = {};
|
|
1153
|
-
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1154
|
-
return yield this.client.call('get', uri, {
|
|
1155
|
-
'content-type': 'application/json',
|
|
1156
|
-
}, payload);
|
|
1157
|
-
});
|
|
1158
|
-
}
|
|
1159
|
-
/**
|
|
1160
|
-
* Update OAuth session (refresh tokens)
|
|
1161
|
-
*
|
|
1162
|
-
* Access tokens have limited lifespan and expire to mitigate security risks.
|
|
1163
|
-
* If session was created using an OAuth provider, this route can be used to
|
|
1164
|
-
* "refresh" the access token.
|
|
1165
|
-
*
|
|
1166
|
-
* @param {string} sessionId
|
|
1167
|
-
* @throws {AppwriteException}
|
|
1168
|
-
* @returns {Promise}
|
|
1169
|
-
*/
|
|
1170
|
-
updateSession(sessionId) {
|
|
1171
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1172
|
-
if (typeof sessionId === 'undefined') {
|
|
1173
|
-
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1174
|
-
}
|
|
1175
|
-
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
1176
|
-
const payload = {};
|
|
1177
|
-
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1178
|
-
return yield this.client.call('patch', uri, {
|
|
1179
|
-
'content-type': 'application/json',
|
|
1180
|
-
}, payload);
|
|
1181
|
-
});
|
|
1182
|
-
}
|
|
1183
|
-
/**
|
|
1184
|
-
* Delete session
|
|
1185
|
-
*
|
|
1186
|
-
* Logout the user. Use 'current' as the session ID to logout on this device,
|
|
1187
|
-
* use a session ID to logout on another device. If you're looking to logout
|
|
1188
|
-
* the user on all devices, use [Delete
|
|
1189
|
-
* Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions)
|
|
1190
|
-
* instead.
|
|
1191
|
-
*
|
|
1192
|
-
* @param {string} sessionId
|
|
1193
|
-
* @throws {AppwriteException}
|
|
1194
|
-
* @returns {Promise}
|
|
1195
|
-
*/
|
|
1196
|
-
deleteSession(sessionId) {
|
|
1197
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1198
|
-
if (typeof sessionId === 'undefined') {
|
|
1199
|
-
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1200
|
-
}
|
|
1201
|
-
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
1202
|
-
const payload = {};
|
|
1203
|
-
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1204
|
-
return yield this.client.call('delete', uri, {
|
|
1205
|
-
'content-type': 'application/json',
|
|
1206
|
-
}, payload);
|
|
1207
|
-
});
|
|
1208
|
-
}
|
|
1209
|
-
/**
|
|
1210
|
-
* Update status
|
|
1211
|
-
*
|
|
1212
|
-
* Block the currently logged in user account. Behind the scene, the user
|
|
1213
|
-
* record is not deleted but permanently blocked from any access. To
|
|
1214
|
-
* completely delete a user, use the Users API instead.
|
|
1215
|
-
*
|
|
1216
|
-
* @throws {AppwriteException}
|
|
1217
|
-
* @returns {Promise}
|
|
1218
|
-
*/
|
|
1219
|
-
updateStatus() {
|
|
1220
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1221
|
-
const apiPath = '/account/status';
|
|
1222
|
-
const payload = {};
|
|
1223
|
-
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1224
|
-
return yield this.client.call('patch', uri, {
|
|
1225
|
-
'content-type': 'application/json',
|
|
1226
|
-
}, payload);
|
|
1227
|
-
});
|
|
1228
|
-
}
|
|
1229
1698
|
/**
|
|
1230
1699
|
* Create email verification
|
|
1231
1700
|
*
|
|
@@ -1380,7 +1849,7 @@ class Avatars extends Service {
|
|
|
1380
1849
|
* image at source quality. If dimensions are not specified, the default size
|
|
1381
1850
|
* of image returned is 100x100px.
|
|
1382
1851
|
*
|
|
1383
|
-
* @param {
|
|
1852
|
+
* @param {Browser} code
|
|
1384
1853
|
* @param {number} width
|
|
1385
1854
|
* @param {number} height
|
|
1386
1855
|
* @param {number} quality
|
|
@@ -1422,7 +1891,7 @@ class Avatars extends Service {
|
|
|
1422
1891
|
* of image returned is 100x100px.
|
|
1423
1892
|
*
|
|
1424
1893
|
*
|
|
1425
|
-
* @param {
|
|
1894
|
+
* @param {CreditCard} code
|
|
1426
1895
|
* @param {number} width
|
|
1427
1896
|
* @param {number} height
|
|
1428
1897
|
* @param {number} quality
|
|
@@ -1492,7 +1961,7 @@ class Avatars extends Service {
|
|
|
1492
1961
|
* of image returned is 100x100px.
|
|
1493
1962
|
*
|
|
1494
1963
|
*
|
|
1495
|
-
* @param {
|
|
1964
|
+
* @param {Flag} code
|
|
1496
1965
|
* @param {number} width
|
|
1497
1966
|
* @param {number} height
|
|
1498
1967
|
* @param {number} quality
|
|
@@ -1699,7 +2168,7 @@ class Databases extends Service {
|
|
|
1699
2168
|
* @param {string} databaseId
|
|
1700
2169
|
* @param {string} collectionId
|
|
1701
2170
|
* @param {string} documentId
|
|
1702
|
-
* @param {
|
|
2171
|
+
* @param {object} data
|
|
1703
2172
|
* @param {string[]} permissions
|
|
1704
2173
|
* @throws {AppwriteException}
|
|
1705
2174
|
* @returns {Promise}
|
|
@@ -1779,7 +2248,7 @@ class Databases extends Service {
|
|
|
1779
2248
|
* @param {string} databaseId
|
|
1780
2249
|
* @param {string} collectionId
|
|
1781
2250
|
* @param {string} documentId
|
|
1782
|
-
* @param {
|
|
2251
|
+
* @param {object} data
|
|
1783
2252
|
* @param {string[]} permissions
|
|
1784
2253
|
* @throws {AppwriteException}
|
|
1785
2254
|
* @returns {Promise}
|
|
@@ -1888,7 +2357,7 @@ class Functions extends Service {
|
|
|
1888
2357
|
* @param {string} body
|
|
1889
2358
|
* @param {boolean} async
|
|
1890
2359
|
* @param {string} xpath
|
|
1891
|
-
* @param {
|
|
2360
|
+
* @param {ExecutionMethod} method
|
|
1892
2361
|
* @param {object} headers
|
|
1893
2362
|
* @throws {AppwriteException}
|
|
1894
2363
|
* @returns {Promise}
|
|
@@ -2170,6 +2639,74 @@ class Locale extends Service {
|
|
|
2170
2639
|
}
|
|
2171
2640
|
}
|
|
2172
2641
|
|
|
2642
|
+
class Messaging extends Service {
|
|
2643
|
+
constructor(client) {
|
|
2644
|
+
super(client);
|
|
2645
|
+
}
|
|
2646
|
+
/**
|
|
2647
|
+
* Create subscriber
|
|
2648
|
+
*
|
|
2649
|
+
* Create a new subscriber.
|
|
2650
|
+
*
|
|
2651
|
+
* @param {string} topicId
|
|
2652
|
+
* @param {string} subscriberId
|
|
2653
|
+
* @param {string} targetId
|
|
2654
|
+
* @throws {AppwriteException}
|
|
2655
|
+
* @returns {Promise}
|
|
2656
|
+
*/
|
|
2657
|
+
createSubscriber(topicId, subscriberId, targetId) {
|
|
2658
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2659
|
+
if (typeof topicId === 'undefined') {
|
|
2660
|
+
throw new AppwriteException('Missing required parameter: "topicId"');
|
|
2661
|
+
}
|
|
2662
|
+
if (typeof subscriberId === 'undefined') {
|
|
2663
|
+
throw new AppwriteException('Missing required parameter: "subscriberId"');
|
|
2664
|
+
}
|
|
2665
|
+
if (typeof targetId === 'undefined') {
|
|
2666
|
+
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
2667
|
+
}
|
|
2668
|
+
const apiPath = '/messaging/topics/{topicId}/subscribers'.replace('{topicId}', topicId);
|
|
2669
|
+
const payload = {};
|
|
2670
|
+
if (typeof subscriberId !== 'undefined') {
|
|
2671
|
+
payload['subscriberId'] = subscriberId;
|
|
2672
|
+
}
|
|
2673
|
+
if (typeof targetId !== 'undefined') {
|
|
2674
|
+
payload['targetId'] = targetId;
|
|
2675
|
+
}
|
|
2676
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2677
|
+
return yield this.client.call('post', uri, {
|
|
2678
|
+
'content-type': 'application/json',
|
|
2679
|
+
}, payload);
|
|
2680
|
+
});
|
|
2681
|
+
}
|
|
2682
|
+
/**
|
|
2683
|
+
* Delete subscriber
|
|
2684
|
+
*
|
|
2685
|
+
* Delete a subscriber by its unique ID.
|
|
2686
|
+
*
|
|
2687
|
+
* @param {string} topicId
|
|
2688
|
+
* @param {string} subscriberId
|
|
2689
|
+
* @throws {AppwriteException}
|
|
2690
|
+
* @returns {Promise}
|
|
2691
|
+
*/
|
|
2692
|
+
deleteSubscriber(topicId, subscriberId) {
|
|
2693
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2694
|
+
if (typeof topicId === 'undefined') {
|
|
2695
|
+
throw new AppwriteException('Missing required parameter: "topicId"');
|
|
2696
|
+
}
|
|
2697
|
+
if (typeof subscriberId === 'undefined') {
|
|
2698
|
+
throw new AppwriteException('Missing required parameter: "subscriberId"');
|
|
2699
|
+
}
|
|
2700
|
+
const apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}'.replace('{topicId}', topicId).replace('{subscriberId}', subscriberId);
|
|
2701
|
+
const payload = {};
|
|
2702
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2703
|
+
return yield this.client.call('delete', uri, {
|
|
2704
|
+
'content-type': 'application/json',
|
|
2705
|
+
}, payload);
|
|
2706
|
+
});
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2709
|
+
|
|
2173
2710
|
class Storage extends Service {
|
|
2174
2711
|
constructor(client) {
|
|
2175
2712
|
super(client);
|
|
@@ -2276,6 +2813,7 @@ class Storage extends Service {
|
|
|
2276
2813
|
catch (e) {
|
|
2277
2814
|
}
|
|
2278
2815
|
}
|
|
2816
|
+
let timestamp = new Date().getTime();
|
|
2279
2817
|
while (offset < size) {
|
|
2280
2818
|
let end = Math.min(offset + Service.CHUNK_SIZE - 1, size - 1);
|
|
2281
2819
|
apiHeaders['content-range'] = 'bytes ' + offset + '-' + end + '/' + size;
|
|
@@ -2288,8 +2826,8 @@ class Storage extends Service {
|
|
|
2288
2826
|
length: Service.CHUNK_SIZE
|
|
2289
2827
|
});
|
|
2290
2828
|
var path = `data:${file.type};base64,${chunk}`;
|
|
2291
|
-
if (Platform.OS.toLowerCase()
|
|
2292
|
-
path = FileSystem.cacheDirectory + '/
|
|
2829
|
+
if (Platform.OS.toLowerCase() === 'android') {
|
|
2830
|
+
path = FileSystem.cacheDirectory + '/tmp_chunk_' + timestamp;
|
|
2293
2831
|
yield FileSystem.writeAsStringAsync(path, chunk, { encoding: FileSystem.EncodingType.Base64 });
|
|
2294
2832
|
}
|
|
2295
2833
|
payload['file'] = { uri: path, name: file.name, type: file.type };
|
|
@@ -2438,7 +2976,7 @@ class Storage extends Service {
|
|
|
2438
2976
|
* @param {string} fileId
|
|
2439
2977
|
* @param {number} width
|
|
2440
2978
|
* @param {number} height
|
|
2441
|
-
* @param {
|
|
2979
|
+
* @param {ImageGravity} gravity
|
|
2442
2980
|
* @param {number} quality
|
|
2443
2981
|
* @param {number} borderWidth
|
|
2444
2982
|
* @param {string} borderColor
|
|
@@ -2446,7 +2984,7 @@ class Storage extends Service {
|
|
|
2446
2984
|
* @param {number} opacity
|
|
2447
2985
|
* @param {number} rotation
|
|
2448
2986
|
* @param {string} background
|
|
2449
|
-
* @param {
|
|
2987
|
+
* @param {ImageFormat} output
|
|
2450
2988
|
* @throws {AppwriteException}
|
|
2451
2989
|
* @returns {URL}
|
|
2452
2990
|
*/
|
|
@@ -2966,6 +3504,50 @@ class Teams extends Service {
|
|
|
2966
3504
|
}
|
|
2967
3505
|
}
|
|
2968
3506
|
|
|
3507
|
+
class Query {
|
|
3508
|
+
constructor(method, attribute, values) {
|
|
3509
|
+
this.method = method;
|
|
3510
|
+
this.attribute = attribute;
|
|
3511
|
+
if (values !== undefined) {
|
|
3512
|
+
if (Array.isArray(values)) {
|
|
3513
|
+
this.values = values;
|
|
3514
|
+
}
|
|
3515
|
+
else {
|
|
3516
|
+
this.values = [values];
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3519
|
+
}
|
|
3520
|
+
toString() {
|
|
3521
|
+
return JSON.stringify({
|
|
3522
|
+
method: this.method,
|
|
3523
|
+
attribute: this.attribute,
|
|
3524
|
+
values: this.values,
|
|
3525
|
+
});
|
|
3526
|
+
}
|
|
3527
|
+
}
|
|
3528
|
+
Query.equal = (attribute, value) => new Query("equal", attribute, value).toString();
|
|
3529
|
+
Query.notEqual = (attribute, value) => new Query("notEqual", attribute, value).toString();
|
|
3530
|
+
Query.lessThan = (attribute, value) => new Query("lessThan", attribute, value).toString();
|
|
3531
|
+
Query.lessThanEqual = (attribute, value) => new Query("lessThanEqual", attribute, value).toString();
|
|
3532
|
+
Query.greaterThan = (attribute, value) => new Query("greaterThan", attribute, value).toString();
|
|
3533
|
+
Query.greaterThanEqual = (attribute, value) => new Query("greaterThanEqual", attribute, value).toString();
|
|
3534
|
+
Query.isNull = (attribute) => new Query("isNull", attribute).toString();
|
|
3535
|
+
Query.isNotNull = (attribute) => new Query("isNotNull", attribute).toString();
|
|
3536
|
+
Query.between = (attribute, start, end) => new Query("between", attribute, [start, end]).toString();
|
|
3537
|
+
Query.startsWith = (attribute, value) => new Query("startsWith", attribute, value).toString();
|
|
3538
|
+
Query.endsWith = (attribute, value) => new Query("endsWith", attribute, value).toString();
|
|
3539
|
+
Query.select = (attributes) => new Query("select", undefined, attributes).toString();
|
|
3540
|
+
Query.search = (attribute, value) => new Query("search", attribute, value).toString();
|
|
3541
|
+
Query.orderDesc = (attribute) => new Query("orderDesc", attribute).toString();
|
|
3542
|
+
Query.orderAsc = (attribute) => new Query("orderAsc", attribute).toString();
|
|
3543
|
+
Query.cursorAfter = (documentId) => new Query("cursorAfter", undefined, documentId).toString();
|
|
3544
|
+
Query.cursorBefore = (documentId) => new Query("cursorBefore", undefined, documentId).toString();
|
|
3545
|
+
Query.limit = (limit) => new Query("limit", undefined, limit).toString();
|
|
3546
|
+
Query.offset = (offset) => new Query("offset", undefined, offset).toString();
|
|
3547
|
+
Query.contains = (attribute, value) => new Query("contains", attribute, value).toString();
|
|
3548
|
+
Query.or = (queries) => new Query("or", undefined, queries.map((query) => JSON.parse(query))).toString();
|
|
3549
|
+
Query.and = (queries) => new Query("and", undefined, queries.map((query) => JSON.parse(query))).toString();
|
|
3550
|
+
|
|
2969
3551
|
class Permission {
|
|
2970
3552
|
}
|
|
2971
3553
|
Permission.read = (role) => {
|
|
@@ -3078,14 +3660,355 @@ class Role {
|
|
|
3078
3660
|
}
|
|
3079
3661
|
}
|
|
3080
3662
|
|
|
3663
|
+
var _a, _ID_hexTimestamp;
|
|
3081
3664
|
class ID {
|
|
3082
3665
|
static custom(id) {
|
|
3083
3666
|
return id;
|
|
3084
3667
|
}
|
|
3085
|
-
static unique() {
|
|
3086
|
-
|
|
3668
|
+
static unique(padding = 7) {
|
|
3669
|
+
// Generate a unique ID with padding to have a longer ID
|
|
3670
|
+
const baseId = __classPrivateFieldGet(ID, _a, "m", _ID_hexTimestamp).call(ID);
|
|
3671
|
+
let randomPadding = '';
|
|
3672
|
+
for (let i = 0; i < padding; i++) {
|
|
3673
|
+
const randomHexDigit = Math.floor(Math.random() * 16).toString(16);
|
|
3674
|
+
randomPadding += randomHexDigit;
|
|
3675
|
+
}
|
|
3676
|
+
return baseId + randomPadding;
|
|
3087
3677
|
}
|
|
3088
3678
|
}
|
|
3679
|
+
_a = ID, _ID_hexTimestamp = function _ID_hexTimestamp() {
|
|
3680
|
+
const now = new Date();
|
|
3681
|
+
const sec = Math.floor(now.getTime() / 1000);
|
|
3682
|
+
const msec = now.getMilliseconds();
|
|
3683
|
+
// Convert to hexadecimal
|
|
3684
|
+
const hexTimestamp = sec.toString(16) + msec.toString(16).padStart(5, '0');
|
|
3685
|
+
return hexTimestamp;
|
|
3686
|
+
};
|
|
3687
|
+
|
|
3688
|
+
var AuthenticatorType;
|
|
3689
|
+
(function (AuthenticatorType) {
|
|
3690
|
+
AuthenticatorType["Totp"] = "totp";
|
|
3691
|
+
})(AuthenticatorType || (AuthenticatorType = {}));
|
|
3692
|
+
|
|
3693
|
+
var AuthenticationFactor;
|
|
3694
|
+
(function (AuthenticationFactor) {
|
|
3695
|
+
AuthenticationFactor["Email"] = "email";
|
|
3696
|
+
AuthenticationFactor["Phone"] = "phone";
|
|
3697
|
+
AuthenticationFactor["Totp"] = "totp";
|
|
3698
|
+
AuthenticationFactor["Recoverycode"] = "recoverycode";
|
|
3699
|
+
})(AuthenticationFactor || (AuthenticationFactor = {}));
|
|
3700
|
+
|
|
3701
|
+
var OAuthProvider;
|
|
3702
|
+
(function (OAuthProvider) {
|
|
3703
|
+
OAuthProvider["Amazon"] = "amazon";
|
|
3704
|
+
OAuthProvider["Apple"] = "apple";
|
|
3705
|
+
OAuthProvider["Auth0"] = "auth0";
|
|
3706
|
+
OAuthProvider["Authentik"] = "authentik";
|
|
3707
|
+
OAuthProvider["Autodesk"] = "autodesk";
|
|
3708
|
+
OAuthProvider["Bitbucket"] = "bitbucket";
|
|
3709
|
+
OAuthProvider["Bitly"] = "bitly";
|
|
3710
|
+
OAuthProvider["Box"] = "box";
|
|
3711
|
+
OAuthProvider["Dailymotion"] = "dailymotion";
|
|
3712
|
+
OAuthProvider["Discord"] = "discord";
|
|
3713
|
+
OAuthProvider["Disqus"] = "disqus";
|
|
3714
|
+
OAuthProvider["Dropbox"] = "dropbox";
|
|
3715
|
+
OAuthProvider["Etsy"] = "etsy";
|
|
3716
|
+
OAuthProvider["Facebook"] = "facebook";
|
|
3717
|
+
OAuthProvider["Github"] = "github";
|
|
3718
|
+
OAuthProvider["Gitlab"] = "gitlab";
|
|
3719
|
+
OAuthProvider["Google"] = "google";
|
|
3720
|
+
OAuthProvider["Linkedin"] = "linkedin";
|
|
3721
|
+
OAuthProvider["Microsoft"] = "microsoft";
|
|
3722
|
+
OAuthProvider["Notion"] = "notion";
|
|
3723
|
+
OAuthProvider["Oidc"] = "oidc";
|
|
3724
|
+
OAuthProvider["Okta"] = "okta";
|
|
3725
|
+
OAuthProvider["Paypal"] = "paypal";
|
|
3726
|
+
OAuthProvider["PaypalSandbox"] = "paypalSandbox";
|
|
3727
|
+
OAuthProvider["Podio"] = "podio";
|
|
3728
|
+
OAuthProvider["Salesforce"] = "salesforce";
|
|
3729
|
+
OAuthProvider["Slack"] = "slack";
|
|
3730
|
+
OAuthProvider["Spotify"] = "spotify";
|
|
3731
|
+
OAuthProvider["Stripe"] = "stripe";
|
|
3732
|
+
OAuthProvider["Tradeshift"] = "tradeshift";
|
|
3733
|
+
OAuthProvider["TradeshiftBox"] = "tradeshiftBox";
|
|
3734
|
+
OAuthProvider["Twitch"] = "twitch";
|
|
3735
|
+
OAuthProvider["Wordpress"] = "wordpress";
|
|
3736
|
+
OAuthProvider["Yahoo"] = "yahoo";
|
|
3737
|
+
OAuthProvider["Yammer"] = "yammer";
|
|
3738
|
+
OAuthProvider["Yandex"] = "yandex";
|
|
3739
|
+
OAuthProvider["Zoho"] = "zoho";
|
|
3740
|
+
OAuthProvider["Zoom"] = "zoom";
|
|
3741
|
+
OAuthProvider["Mock"] = "mock";
|
|
3742
|
+
})(OAuthProvider || (OAuthProvider = {}));
|
|
3743
|
+
|
|
3744
|
+
var Browser;
|
|
3745
|
+
(function (Browser) {
|
|
3746
|
+
Browser["AvantBrowser"] = "aa";
|
|
3747
|
+
Browser["AndroidWebViewBeta"] = "an";
|
|
3748
|
+
Browser["GoogleChrome"] = "ch";
|
|
3749
|
+
Browser["GoogleChromeIOS"] = "ci";
|
|
3750
|
+
Browser["GoogleChromeMobile"] = "cm";
|
|
3751
|
+
Browser["Chromium"] = "cr";
|
|
3752
|
+
Browser["MozillaFirefox"] = "ff";
|
|
3753
|
+
Browser["Safari"] = "sf";
|
|
3754
|
+
Browser["MobileSafari"] = "mf";
|
|
3755
|
+
Browser["MicrosoftEdge"] = "ps";
|
|
3756
|
+
Browser["MicrosoftEdgeIOS"] = "oi";
|
|
3757
|
+
Browser["OperaMini"] = "om";
|
|
3758
|
+
Browser["Opera"] = "op";
|
|
3759
|
+
Browser["OperaNext"] = "on";
|
|
3760
|
+
})(Browser || (Browser = {}));
|
|
3761
|
+
|
|
3762
|
+
var CreditCard;
|
|
3763
|
+
(function (CreditCard) {
|
|
3764
|
+
CreditCard["AmericanExpress"] = "amex";
|
|
3765
|
+
CreditCard["Argencard"] = "argencard";
|
|
3766
|
+
CreditCard["Cabal"] = "cabal";
|
|
3767
|
+
CreditCard["Consosud"] = "censosud";
|
|
3768
|
+
CreditCard["DinersClub"] = "diners";
|
|
3769
|
+
CreditCard["Discover"] = "discover";
|
|
3770
|
+
CreditCard["Elo"] = "elo";
|
|
3771
|
+
CreditCard["Hipercard"] = "hipercard";
|
|
3772
|
+
CreditCard["JCB"] = "jcb";
|
|
3773
|
+
CreditCard["Mastercard"] = "mastercard";
|
|
3774
|
+
CreditCard["Naranja"] = "naranja";
|
|
3775
|
+
CreditCard["TarjetaShopping"] = "targeta-shopping";
|
|
3776
|
+
CreditCard["UnionChinaPay"] = "union-china-pay";
|
|
3777
|
+
CreditCard["Visa"] = "visa";
|
|
3778
|
+
CreditCard["MIR"] = "mir";
|
|
3779
|
+
CreditCard["Maestro"] = "maestro";
|
|
3780
|
+
})(CreditCard || (CreditCard = {}));
|
|
3781
|
+
|
|
3782
|
+
var Flag;
|
|
3783
|
+
(function (Flag) {
|
|
3784
|
+
Flag["Afghanistan"] = "af";
|
|
3785
|
+
Flag["Angola"] = "ao";
|
|
3786
|
+
Flag["Albania"] = "al";
|
|
3787
|
+
Flag["Andorra"] = "ad";
|
|
3788
|
+
Flag["UnitedArabEmirates"] = "ae";
|
|
3789
|
+
Flag["Argentina"] = "ar";
|
|
3790
|
+
Flag["Armenia"] = "am";
|
|
3791
|
+
Flag["AntiguaAndBarbuda"] = "ag";
|
|
3792
|
+
Flag["Australia"] = "au";
|
|
3793
|
+
Flag["Austria"] = "at";
|
|
3794
|
+
Flag["Azerbaijan"] = "az";
|
|
3795
|
+
Flag["Burundi"] = "bi";
|
|
3796
|
+
Flag["Belgium"] = "be";
|
|
3797
|
+
Flag["Benin"] = "bj";
|
|
3798
|
+
Flag["BurkinaFaso"] = "bf";
|
|
3799
|
+
Flag["Bangladesh"] = "bd";
|
|
3800
|
+
Flag["Bulgaria"] = "bg";
|
|
3801
|
+
Flag["Bahrain"] = "bh";
|
|
3802
|
+
Flag["Bahamas"] = "bs";
|
|
3803
|
+
Flag["BosniaAndHerzegovina"] = "ba";
|
|
3804
|
+
Flag["Belarus"] = "by";
|
|
3805
|
+
Flag["Belize"] = "bz";
|
|
3806
|
+
Flag["Bolivia"] = "bo";
|
|
3807
|
+
Flag["Brazil"] = "br";
|
|
3808
|
+
Flag["Barbados"] = "bb";
|
|
3809
|
+
Flag["BruneiDarussalam"] = "bn";
|
|
3810
|
+
Flag["Bhutan"] = "bt";
|
|
3811
|
+
Flag["Botswana"] = "bw";
|
|
3812
|
+
Flag["CentralAfricanRepublic"] = "cf";
|
|
3813
|
+
Flag["Canada"] = "ca";
|
|
3814
|
+
Flag["Switzerland"] = "ch";
|
|
3815
|
+
Flag["Chile"] = "cl";
|
|
3816
|
+
Flag["China"] = "cn";
|
|
3817
|
+
Flag["CoteDIvoire"] = "ci";
|
|
3818
|
+
Flag["Cameroon"] = "cm";
|
|
3819
|
+
Flag["DemocraticRepublicOfTheCongo"] = "cd";
|
|
3820
|
+
Flag["RepublicOfTheCongo"] = "cg";
|
|
3821
|
+
Flag["Colombia"] = "co";
|
|
3822
|
+
Flag["Comoros"] = "km";
|
|
3823
|
+
Flag["CapeVerde"] = "cv";
|
|
3824
|
+
Flag["CostaRica"] = "cr";
|
|
3825
|
+
Flag["Cuba"] = "cu";
|
|
3826
|
+
Flag["Cyprus"] = "cy";
|
|
3827
|
+
Flag["CzechRepublic"] = "cz";
|
|
3828
|
+
Flag["Germany"] = "de";
|
|
3829
|
+
Flag["Djibouti"] = "dj";
|
|
3830
|
+
Flag["Dominica"] = "dm";
|
|
3831
|
+
Flag["Denmark"] = "dk";
|
|
3832
|
+
Flag["DominicanRepublic"] = "do";
|
|
3833
|
+
Flag["Algeria"] = "dz";
|
|
3834
|
+
Flag["Ecuador"] = "ec";
|
|
3835
|
+
Flag["Egypt"] = "eg";
|
|
3836
|
+
Flag["Eritrea"] = "er";
|
|
3837
|
+
Flag["Spain"] = "es";
|
|
3838
|
+
Flag["Estonia"] = "ee";
|
|
3839
|
+
Flag["Ethiopia"] = "et";
|
|
3840
|
+
Flag["Finland"] = "fi";
|
|
3841
|
+
Flag["Fiji"] = "fj";
|
|
3842
|
+
Flag["France"] = "fr";
|
|
3843
|
+
Flag["MicronesiaFederatedStatesOf"] = "fm";
|
|
3844
|
+
Flag["Gabon"] = "ga";
|
|
3845
|
+
Flag["UnitedKingdom"] = "gb";
|
|
3846
|
+
Flag["Georgia"] = "ge";
|
|
3847
|
+
Flag["Ghana"] = "gh";
|
|
3848
|
+
Flag["Guinea"] = "gn";
|
|
3849
|
+
Flag["Gambia"] = "gm";
|
|
3850
|
+
Flag["GuineaBissau"] = "gw";
|
|
3851
|
+
Flag["EquatorialGuinea"] = "gq";
|
|
3852
|
+
Flag["Greece"] = "gr";
|
|
3853
|
+
Flag["Grenada"] = "gd";
|
|
3854
|
+
Flag["Guatemala"] = "gt";
|
|
3855
|
+
Flag["Guyana"] = "gy";
|
|
3856
|
+
Flag["Honduras"] = "hn";
|
|
3857
|
+
Flag["Croatia"] = "hr";
|
|
3858
|
+
Flag["Haiti"] = "ht";
|
|
3859
|
+
Flag["Hungary"] = "hu";
|
|
3860
|
+
Flag["Indonesia"] = "id";
|
|
3861
|
+
Flag["India"] = "in";
|
|
3862
|
+
Flag["Ireland"] = "ie";
|
|
3863
|
+
Flag["IranIslamicRepublicOf"] = "ir";
|
|
3864
|
+
Flag["Iraq"] = "iq";
|
|
3865
|
+
Flag["Iceland"] = "is";
|
|
3866
|
+
Flag["Israel"] = "il";
|
|
3867
|
+
Flag["Italy"] = "it";
|
|
3868
|
+
Flag["Jamaica"] = "jm";
|
|
3869
|
+
Flag["Jordan"] = "jo";
|
|
3870
|
+
Flag["Japan"] = "jp";
|
|
3871
|
+
Flag["Kazakhstan"] = "kz";
|
|
3872
|
+
Flag["Kenya"] = "ke";
|
|
3873
|
+
Flag["Kyrgyzstan"] = "kg";
|
|
3874
|
+
Flag["Cambodia"] = "kh";
|
|
3875
|
+
Flag["Kiribati"] = "ki";
|
|
3876
|
+
Flag["SaintKittsAndNevis"] = "kn";
|
|
3877
|
+
Flag["SouthKorea"] = "kr";
|
|
3878
|
+
Flag["Kuwait"] = "kw";
|
|
3879
|
+
Flag["LaoPeopleSDemocraticRepublic"] = "la";
|
|
3880
|
+
Flag["Lebanon"] = "lb";
|
|
3881
|
+
Flag["Liberia"] = "lr";
|
|
3882
|
+
Flag["Libya"] = "ly";
|
|
3883
|
+
Flag["SaintLucia"] = "lc";
|
|
3884
|
+
Flag["Liechtenstein"] = "li";
|
|
3885
|
+
Flag["SriLanka"] = "lk";
|
|
3886
|
+
Flag["Lesotho"] = "ls";
|
|
3887
|
+
Flag["Lithuania"] = "lt";
|
|
3888
|
+
Flag["Luxembourg"] = "lu";
|
|
3889
|
+
Flag["Latvia"] = "lv";
|
|
3890
|
+
Flag["Morocco"] = "ma";
|
|
3891
|
+
Flag["Monaco"] = "mc";
|
|
3892
|
+
Flag["Moldova"] = "md";
|
|
3893
|
+
Flag["Madagascar"] = "mg";
|
|
3894
|
+
Flag["Maldives"] = "mv";
|
|
3895
|
+
Flag["Mexico"] = "mx";
|
|
3896
|
+
Flag["MarshallIslands"] = "mh";
|
|
3897
|
+
Flag["NorthMacedonia"] = "mk";
|
|
3898
|
+
Flag["Mali"] = "ml";
|
|
3899
|
+
Flag["Malta"] = "mt";
|
|
3900
|
+
Flag["Myanmar"] = "mm";
|
|
3901
|
+
Flag["Montenegro"] = "me";
|
|
3902
|
+
Flag["Mongolia"] = "mn";
|
|
3903
|
+
Flag["Mozambique"] = "mz";
|
|
3904
|
+
Flag["Mauritania"] = "mr";
|
|
3905
|
+
Flag["Mauritius"] = "mu";
|
|
3906
|
+
Flag["Malawi"] = "mw";
|
|
3907
|
+
Flag["Malaysia"] = "my";
|
|
3908
|
+
Flag["Namibia"] = "na";
|
|
3909
|
+
Flag["Niger"] = "ne";
|
|
3910
|
+
Flag["Nigeria"] = "ng";
|
|
3911
|
+
Flag["Nicaragua"] = "ni";
|
|
3912
|
+
Flag["Netherlands"] = "nl";
|
|
3913
|
+
Flag["Norway"] = "no";
|
|
3914
|
+
Flag["Nepal"] = "np";
|
|
3915
|
+
Flag["Nauru"] = "nr";
|
|
3916
|
+
Flag["NewZealand"] = "nz";
|
|
3917
|
+
Flag["Oman"] = "om";
|
|
3918
|
+
Flag["Pakistan"] = "pk";
|
|
3919
|
+
Flag["Panama"] = "pa";
|
|
3920
|
+
Flag["Peru"] = "pe";
|
|
3921
|
+
Flag["Philippines"] = "ph";
|
|
3922
|
+
Flag["Palau"] = "pw";
|
|
3923
|
+
Flag["PapuaNewGuinea"] = "pg";
|
|
3924
|
+
Flag["Poland"] = "pl";
|
|
3925
|
+
Flag["FrenchPolynesia"] = "pf";
|
|
3926
|
+
Flag["NorthKorea"] = "kp";
|
|
3927
|
+
Flag["Portugal"] = "pt";
|
|
3928
|
+
Flag["Paraguay"] = "py";
|
|
3929
|
+
Flag["Qatar"] = "qa";
|
|
3930
|
+
Flag["Romania"] = "ro";
|
|
3931
|
+
Flag["Russia"] = "ru";
|
|
3932
|
+
Flag["Rwanda"] = "rw";
|
|
3933
|
+
Flag["SaudiArabia"] = "sa";
|
|
3934
|
+
Flag["Sudan"] = "sd";
|
|
3935
|
+
Flag["Senegal"] = "sn";
|
|
3936
|
+
Flag["Singapore"] = "sg";
|
|
3937
|
+
Flag["SolomonIslands"] = "sb";
|
|
3938
|
+
Flag["SierraLeone"] = "sl";
|
|
3939
|
+
Flag["ElSalvador"] = "sv";
|
|
3940
|
+
Flag["SanMarino"] = "sm";
|
|
3941
|
+
Flag["Somalia"] = "so";
|
|
3942
|
+
Flag["Serbia"] = "rs";
|
|
3943
|
+
Flag["SouthSudan"] = "ss";
|
|
3944
|
+
Flag["SaoTomeAndPrincipe"] = "st";
|
|
3945
|
+
Flag["Suriname"] = "sr";
|
|
3946
|
+
Flag["Slovakia"] = "sk";
|
|
3947
|
+
Flag["Slovenia"] = "si";
|
|
3948
|
+
Flag["Sweden"] = "se";
|
|
3949
|
+
Flag["Eswatini"] = "sz";
|
|
3950
|
+
Flag["Seychelles"] = "sc";
|
|
3951
|
+
Flag["Syria"] = "sy";
|
|
3952
|
+
Flag["Chad"] = "td";
|
|
3953
|
+
Flag["Togo"] = "tg";
|
|
3954
|
+
Flag["Thailand"] = "th";
|
|
3955
|
+
Flag["Tajikistan"] = "tj";
|
|
3956
|
+
Flag["Turkmenistan"] = "tm";
|
|
3957
|
+
Flag["TimorLeste"] = "tl";
|
|
3958
|
+
Flag["Tonga"] = "to";
|
|
3959
|
+
Flag["TrinidadAndTobago"] = "tt";
|
|
3960
|
+
Flag["Tunisia"] = "tn";
|
|
3961
|
+
Flag["Turkey"] = "tr";
|
|
3962
|
+
Flag["Tuvalu"] = "tv";
|
|
3963
|
+
Flag["Tanzania"] = "tz";
|
|
3964
|
+
Flag["Uganda"] = "ug";
|
|
3965
|
+
Flag["Ukraine"] = "ua";
|
|
3966
|
+
Flag["Uruguay"] = "uy";
|
|
3967
|
+
Flag["UnitedStates"] = "us";
|
|
3968
|
+
Flag["Uzbekistan"] = "uz";
|
|
3969
|
+
Flag["VaticanCity"] = "va";
|
|
3970
|
+
Flag["SaintVincentAndTheGrenadines"] = "vc";
|
|
3971
|
+
Flag["Venezuela"] = "ve";
|
|
3972
|
+
Flag["Vietnam"] = "vn";
|
|
3973
|
+
Flag["Vanuatu"] = "vu";
|
|
3974
|
+
Flag["Samoa"] = "ws";
|
|
3975
|
+
Flag["Yemen"] = "ye";
|
|
3976
|
+
Flag["SouthAfrica"] = "za";
|
|
3977
|
+
Flag["Zambia"] = "zm";
|
|
3978
|
+
Flag["Zimbabwe"] = "zw";
|
|
3979
|
+
})(Flag || (Flag = {}));
|
|
3980
|
+
|
|
3981
|
+
var ExecutionMethod;
|
|
3982
|
+
(function (ExecutionMethod) {
|
|
3983
|
+
ExecutionMethod["GET"] = "GET";
|
|
3984
|
+
ExecutionMethod["POST"] = "POST";
|
|
3985
|
+
ExecutionMethod["PUT"] = "PUT";
|
|
3986
|
+
ExecutionMethod["PATCH"] = "PATCH";
|
|
3987
|
+
ExecutionMethod["DELETE"] = "DELETE";
|
|
3988
|
+
ExecutionMethod["OPTIONS"] = "OPTIONS";
|
|
3989
|
+
})(ExecutionMethod || (ExecutionMethod = {}));
|
|
3990
|
+
|
|
3991
|
+
var ImageGravity;
|
|
3992
|
+
(function (ImageGravity) {
|
|
3993
|
+
ImageGravity["Center"] = "center";
|
|
3994
|
+
ImageGravity["TopLeft"] = "top-left";
|
|
3995
|
+
ImageGravity["Top"] = "top";
|
|
3996
|
+
ImageGravity["TopRight"] = "top-right";
|
|
3997
|
+
ImageGravity["Left"] = "left";
|
|
3998
|
+
ImageGravity["Right"] = "right";
|
|
3999
|
+
ImageGravity["BottomLeft"] = "bottom-left";
|
|
4000
|
+
ImageGravity["Bottom"] = "bottom";
|
|
4001
|
+
ImageGravity["BottomRight"] = "bottom-right";
|
|
4002
|
+
})(ImageGravity || (ImageGravity = {}));
|
|
4003
|
+
|
|
4004
|
+
var ImageFormat;
|
|
4005
|
+
(function (ImageFormat) {
|
|
4006
|
+
ImageFormat["Jpg"] = "jpg";
|
|
4007
|
+
ImageFormat["Jpeg"] = "jpeg";
|
|
4008
|
+
ImageFormat["Gif"] = "gif";
|
|
4009
|
+
ImageFormat["Png"] = "png";
|
|
4010
|
+
ImageFormat["Webp"] = "webp";
|
|
4011
|
+
})(ImageFormat || (ImageFormat = {}));
|
|
3089
4012
|
|
|
3090
|
-
export { Account, AppwriteException, Avatars, Client, Databases, Functions, Graphql, ID, Locale, Permission, Query, Role, Storage, Teams };
|
|
4013
|
+
export { Account, AppwriteException, AuthenticationFactor, AuthenticatorType, Avatars, Browser, Client, CreditCard, Databases, ExecutionMethod, Flag, Functions, Graphql, ID, ImageFormat, ImageGravity, Locale, Messaging, OAuthProvider, Permission, Query, Role, Storage, Teams };
|
|
3091
4014
|
//# sourceMappingURL=sdk.js.map
|