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/src/services/avatars.ts
CHANGED
|
@@ -2,6 +2,12 @@ import { Service } from '../service';
|
|
|
2
2
|
import { AppwriteException, Client } from '../client';
|
|
3
3
|
import type { Models } from '../models';
|
|
4
4
|
import type { UploadProgress, Payload } from '../client';
|
|
5
|
+
import * as FileSystem from 'expo-file-system';
|
|
6
|
+
import { Platform } from 'react-native';
|
|
7
|
+
|
|
8
|
+
import { Browser } from '../enums/browser';
|
|
9
|
+
import { CreditCard } from '../enums/credit-card';
|
|
10
|
+
import { Flag } from '../enums/flag';
|
|
5
11
|
|
|
6
12
|
export class Avatars extends Service {
|
|
7
13
|
|
|
@@ -24,14 +30,14 @@ export class Avatars extends Service {
|
|
|
24
30
|
* image at source quality. If dimensions are not specified, the default size
|
|
25
31
|
* of image returned is 100x100px.
|
|
26
32
|
*
|
|
27
|
-
* @param {
|
|
33
|
+
* @param {Browser} code
|
|
28
34
|
* @param {number} width
|
|
29
35
|
* @param {number} height
|
|
30
36
|
* @param {number} quality
|
|
31
37
|
* @throws {AppwriteException}
|
|
32
38
|
* @returns {URL}
|
|
33
39
|
*/
|
|
34
|
-
getBrowser(code:
|
|
40
|
+
getBrowser(code: Browser, width?: number, height?: number, quality?: number): URL {
|
|
35
41
|
if (typeof code === 'undefined') {
|
|
36
42
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
37
43
|
}
|
|
@@ -74,14 +80,14 @@ export class Avatars extends Service {
|
|
|
74
80
|
* of image returned is 100x100px.
|
|
75
81
|
*
|
|
76
82
|
*
|
|
77
|
-
* @param {
|
|
83
|
+
* @param {CreditCard} code
|
|
78
84
|
* @param {number} width
|
|
79
85
|
* @param {number} height
|
|
80
86
|
* @param {number} quality
|
|
81
87
|
* @throws {AppwriteException}
|
|
82
88
|
* @returns {URL}
|
|
83
89
|
*/
|
|
84
|
-
getCreditCard(code:
|
|
90
|
+
getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): URL {
|
|
85
91
|
if (typeof code === 'undefined') {
|
|
86
92
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
87
93
|
}
|
|
@@ -158,14 +164,14 @@ export class Avatars extends Service {
|
|
|
158
164
|
* of image returned is 100x100px.
|
|
159
165
|
*
|
|
160
166
|
*
|
|
161
|
-
* @param {
|
|
167
|
+
* @param {Flag} code
|
|
162
168
|
* @param {number} width
|
|
163
169
|
* @param {number} height
|
|
164
170
|
* @param {number} quality
|
|
165
171
|
* @throws {AppwriteException}
|
|
166
172
|
* @returns {URL}
|
|
167
173
|
*/
|
|
168
|
-
getFlag(code:
|
|
174
|
+
getFlag(code: Flag, width?: number, height?: number, quality?: number): URL {
|
|
169
175
|
if (typeof code === 'undefined') {
|
|
170
176
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
171
177
|
}
|
|
@@ -2,6 +2,9 @@ import { Service } from '../service';
|
|
|
2
2
|
import { AppwriteException, Client } from '../client';
|
|
3
3
|
import type { Models } from '../models';
|
|
4
4
|
import type { UploadProgress, Payload } from '../client';
|
|
5
|
+
import * as FileSystem from 'expo-file-system';
|
|
6
|
+
import { Platform } from 'react-native';
|
|
7
|
+
|
|
5
8
|
|
|
6
9
|
export class Databases extends Service {
|
|
7
10
|
|
|
@@ -55,12 +58,12 @@ export class Databases extends Service {
|
|
|
55
58
|
* @param {string} databaseId
|
|
56
59
|
* @param {string} collectionId
|
|
57
60
|
* @param {string} documentId
|
|
58
|
-
* @param {
|
|
61
|
+
* @param {object} data
|
|
59
62
|
* @param {string[]} permissions
|
|
60
63
|
* @throws {AppwriteException}
|
|
61
64
|
* @returns {Promise}
|
|
62
65
|
*/
|
|
63
|
-
async createDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data:
|
|
66
|
+
async createDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data: object, permissions?: string[]): Promise<Document> {
|
|
64
67
|
if (typeof databaseId === 'undefined') {
|
|
65
68
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
66
69
|
}
|
|
@@ -146,12 +149,12 @@ export class Databases extends Service {
|
|
|
146
149
|
* @param {string} databaseId
|
|
147
150
|
* @param {string} collectionId
|
|
148
151
|
* @param {string} documentId
|
|
149
|
-
* @param {
|
|
152
|
+
* @param {object} data
|
|
150
153
|
* @param {string[]} permissions
|
|
151
154
|
* @throws {AppwriteException}
|
|
152
155
|
* @returns {Promise}
|
|
153
156
|
*/
|
|
154
|
-
async updateDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data?:
|
|
157
|
+
async updateDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data?: object, permissions?: string[]): Promise<Document> {
|
|
155
158
|
if (typeof databaseId === 'undefined') {
|
|
156
159
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
157
160
|
}
|
|
@@ -2,6 +2,10 @@ import { Service } from '../service';
|
|
|
2
2
|
import { AppwriteException, Client } from '../client';
|
|
3
3
|
import type { Models } from '../models';
|
|
4
4
|
import type { UploadProgress, Payload } from '../client';
|
|
5
|
+
import * as FileSystem from 'expo-file-system';
|
|
6
|
+
import { Platform } from 'react-native';
|
|
7
|
+
|
|
8
|
+
import { ExecutionMethod } from '../enums/execution-method';
|
|
5
9
|
|
|
6
10
|
export class Functions extends Service {
|
|
7
11
|
|
|
@@ -56,12 +60,12 @@ export class Functions extends Service {
|
|
|
56
60
|
* @param {string} body
|
|
57
61
|
* @param {boolean} async
|
|
58
62
|
* @param {string} xpath
|
|
59
|
-
* @param {
|
|
63
|
+
* @param {ExecutionMethod} method
|
|
60
64
|
* @param {object} headers
|
|
61
65
|
* @throws {AppwriteException}
|
|
62
66
|
* @returns {Promise}
|
|
63
67
|
*/
|
|
64
|
-
async createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?:
|
|
68
|
+
async createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object): Promise<Models.Execution> {
|
|
65
69
|
if (typeof functionId === 'undefined') {
|
|
66
70
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
67
71
|
}
|
package/src/services/graphql.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { Service } from '../service';
|
|
|
2
2
|
import { AppwriteException, Client } from '../client';
|
|
3
3
|
import type { Models } from '../models';
|
|
4
4
|
import type { UploadProgress, Payload } from '../client';
|
|
5
|
+
import * as FileSystem from 'expo-file-system';
|
|
6
|
+
import { Platform } from 'react-native';
|
|
7
|
+
|
|
5
8
|
|
|
6
9
|
export class Graphql extends Service {
|
|
7
10
|
|
package/src/services/locale.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { Service } from '../service';
|
|
|
2
2
|
import { AppwriteException, Client } from '../client';
|
|
3
3
|
import type { Models } from '../models';
|
|
4
4
|
import type { UploadProgress, Payload } from '../client';
|
|
5
|
+
import * as FileSystem from 'expo-file-system';
|
|
6
|
+
import { Platform } from 'react-native';
|
|
7
|
+
|
|
5
8
|
|
|
6
9
|
export class Locale extends Service {
|
|
7
10
|
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
import * as FileSystem from 'expo-file-system';
|
|
6
|
+
import { Platform } from 'react-native';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export class Messaging extends Service {
|
|
10
|
+
|
|
11
|
+
constructor(client: Client)
|
|
12
|
+
{
|
|
13
|
+
super(client);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Create subscriber
|
|
18
|
+
*
|
|
19
|
+
* Create a new subscriber.
|
|
20
|
+
*
|
|
21
|
+
* @param {string} topicId
|
|
22
|
+
* @param {string} subscriberId
|
|
23
|
+
* @param {string} targetId
|
|
24
|
+
* @throws {AppwriteException}
|
|
25
|
+
* @returns {Promise}
|
|
26
|
+
*/
|
|
27
|
+
async createSubscriber(topicId: string, subscriberId: string, targetId: string): Promise<Models.Subscriber> {
|
|
28
|
+
if (typeof topicId === 'undefined') {
|
|
29
|
+
throw new AppwriteException('Missing required parameter: "topicId"');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (typeof subscriberId === 'undefined') {
|
|
33
|
+
throw new AppwriteException('Missing required parameter: "subscriberId"');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (typeof targetId === 'undefined') {
|
|
37
|
+
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const apiPath = '/messaging/topics/{topicId}/subscribers'.replace('{topicId}', topicId);
|
|
41
|
+
const payload: Payload = {};
|
|
42
|
+
|
|
43
|
+
if (typeof subscriberId !== 'undefined') {
|
|
44
|
+
payload['subscriberId'] = subscriberId;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (typeof targetId !== 'undefined') {
|
|
48
|
+
payload['targetId'] = targetId;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
52
|
+
return await this.client.call('post', uri, {
|
|
53
|
+
'content-type': 'application/json',
|
|
54
|
+
}, payload);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Delete subscriber
|
|
59
|
+
*
|
|
60
|
+
* Delete a subscriber by its unique ID.
|
|
61
|
+
*
|
|
62
|
+
* @param {string} topicId
|
|
63
|
+
* @param {string} subscriberId
|
|
64
|
+
* @throws {AppwriteException}
|
|
65
|
+
* @returns {Promise}
|
|
66
|
+
*/
|
|
67
|
+
async deleteSubscriber(topicId: string, subscriberId: string): Promise<{}> {
|
|
68
|
+
if (typeof topicId === 'undefined') {
|
|
69
|
+
throw new AppwriteException('Missing required parameter: "topicId"');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (typeof subscriberId === 'undefined') {
|
|
73
|
+
throw new AppwriteException('Missing required parameter: "subscriberId"');
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}'.replace('{topicId}', topicId).replace('{subscriberId}', subscriberId);
|
|
77
|
+
const payload: Payload = {};
|
|
78
|
+
|
|
79
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
80
|
+
return await this.client.call('delete', uri, {
|
|
81
|
+
'content-type': 'application/json',
|
|
82
|
+
}, payload);
|
|
83
|
+
}
|
|
84
|
+
};
|
package/src/services/storage.ts
CHANGED
|
@@ -5,6 +5,9 @@ import type { UploadProgress, Payload } from '../client';
|
|
|
5
5
|
import * as FileSystem from 'expo-file-system';
|
|
6
6
|
import { Platform } from 'react-native';
|
|
7
7
|
|
|
8
|
+
import { ImageGravity } from '../enums/image-gravity';
|
|
9
|
+
import { ImageFormat } from '../enums/image-format';
|
|
10
|
+
|
|
8
11
|
export class Storage extends Service {
|
|
9
12
|
|
|
10
13
|
constructor(client: Client)
|
|
@@ -127,6 +130,7 @@ export class Storage extends Service {
|
|
|
127
130
|
}
|
|
128
131
|
}
|
|
129
132
|
|
|
133
|
+
let timestamp = new Date().getTime();
|
|
130
134
|
while (offset < size) {
|
|
131
135
|
let end = Math.min(offset + Service.CHUNK_SIZE - 1, size - 1);
|
|
132
136
|
|
|
@@ -141,11 +145,13 @@ export class Storage extends Service {
|
|
|
141
145
|
length: Service.CHUNK_SIZE
|
|
142
146
|
});
|
|
143
147
|
var path = `data:${file.type};base64,${chunk}`;
|
|
144
|
-
if (Platform.OS.toLowerCase()
|
|
145
|
-
path = FileSystem.cacheDirectory + '/
|
|
148
|
+
if (Platform.OS.toLowerCase() === 'android') {
|
|
149
|
+
path = FileSystem.cacheDirectory + '/tmp_chunk_' + timestamp;
|
|
146
150
|
await FileSystem.writeAsStringAsync(path, chunk, {encoding: FileSystem.EncodingType.Base64});
|
|
147
151
|
}
|
|
148
|
-
|
|
152
|
+
|
|
153
|
+
payload['file'] = { uri: path, name: file.name, type: file.type };
|
|
154
|
+
|
|
149
155
|
response = await this.client.call('post', uri, apiHeaders, payload);
|
|
150
156
|
|
|
151
157
|
if (onProgress) {
|
|
@@ -306,7 +312,7 @@ export class Storage extends Service {
|
|
|
306
312
|
* @param {string} fileId
|
|
307
313
|
* @param {number} width
|
|
308
314
|
* @param {number} height
|
|
309
|
-
* @param {
|
|
315
|
+
* @param {ImageGravity} gravity
|
|
310
316
|
* @param {number} quality
|
|
311
317
|
* @param {number} borderWidth
|
|
312
318
|
* @param {string} borderColor
|
|
@@ -314,11 +320,11 @@ export class Storage extends Service {
|
|
|
314
320
|
* @param {number} opacity
|
|
315
321
|
* @param {number} rotation
|
|
316
322
|
* @param {string} background
|
|
317
|
-
* @param {
|
|
323
|
+
* @param {ImageFormat} output
|
|
318
324
|
* @throws {AppwriteException}
|
|
319
325
|
* @returns {URL}
|
|
320
326
|
*/
|
|
321
|
-
getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?:
|
|
327
|
+
getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat): URL {
|
|
322
328
|
if (typeof bucketId === 'undefined') {
|
|
323
329
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
324
330
|
}
|
package/src/services/teams.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { Service } from '../service';
|
|
|
2
2
|
import { AppwriteException, Client } from '../client';
|
|
3
3
|
import type { Models } from '../models';
|
|
4
4
|
import type { UploadProgress, Payload } from '../client';
|
|
5
|
+
import * as FileSystem from 'expo-file-system';
|
|
6
|
+
import { Platform } from 'react-native';
|
|
7
|
+
|
|
5
8
|
|
|
6
9
|
export class Teams extends Service {
|
|
7
10
|
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Client, Account } from "appwrite";
|
|
2
|
-
|
|
3
|
-
const client = new Client();
|
|
4
|
-
|
|
5
|
-
const account = new Account(client);
|
|
6
|
-
|
|
7
|
-
client
|
|
8
|
-
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
|
9
|
-
.setProject('5df5acd0d48c2') // Your project ID
|
|
10
|
-
;
|
|
11
|
-
|
|
12
|
-
const promise = account.createEmailSession('email@example.com', 'password');
|
|
13
|
-
|
|
14
|
-
promise.then(function (response) {
|
|
15
|
-
console.log(response); // Success
|
|
16
|
-
}, function (error) {
|
|
17
|
-
console.log(error); // Failure
|
|
18
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Client, Account } from "appwrite";
|
|
2
|
-
|
|
3
|
-
const client = new Client();
|
|
4
|
-
|
|
5
|
-
const account = new Account(client);
|
|
6
|
-
|
|
7
|
-
client
|
|
8
|
-
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
|
9
|
-
.setProject('5df5acd0d48c2') // Your project ID
|
|
10
|
-
;
|
|
11
|
-
|
|
12
|
-
const promise = account.createMagicURLSession('[USER_ID]', 'email@example.com');
|
|
13
|
-
|
|
14
|
-
promise.then(function (response) {
|
|
15
|
-
console.log(response); // Success
|
|
16
|
-
}, function (error) {
|
|
17
|
-
console.log(error); // Failure
|
|
18
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Client, Account } from "appwrite";
|
|
2
|
-
|
|
3
|
-
const client = new Client();
|
|
4
|
-
|
|
5
|
-
const account = new Account(client);
|
|
6
|
-
|
|
7
|
-
client
|
|
8
|
-
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
|
9
|
-
.setProject('5df5acd0d48c2') // Your project ID
|
|
10
|
-
;
|
|
11
|
-
|
|
12
|
-
const promise = account.createPhoneSession('[USER_ID]', '+12065550100');
|
|
13
|
-
|
|
14
|
-
promise.then(function (response) {
|
|
15
|
-
console.log(response); // Success
|
|
16
|
-
}, function (error) {
|
|
17
|
-
console.log(error); // Failure
|
|
18
|
-
});
|