react-native-appwrite 0.14.0 → 0.16.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/CHANGELOG.md +5 -0
- package/dist/cjs/sdk.js +61 -5
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +61 -5
- package/dist/esm/sdk.js.map +1 -1
- package/docs/examples/account/create-email-verification.md +13 -0
- package/docs/examples/account/update-email-verification.md +14 -0
- package/package.json +1 -1
- package/src/client.ts +1 -1
- package/src/enums/execution-status.ts +6 -0
- package/src/enums/execution-trigger.ts +5 -0
- package/src/models.ts +5 -2
- package/src/services/account.ts +123 -4
- package/src/services/tables-db.ts +12 -12
- package/types/enums/execution-status.d.ts +6 -0
- package/types/enums/execution-trigger.d.ts +5 -0
- package/types/models.d.ts +4 -2
- package/types/services/account.d.ts +49 -0
- package/types/services/tables-db.d.ts +12 -12
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Client, Account } from "react-native-appwrite";
|
|
2
|
+
|
|
3
|
+
const client = new Client()
|
|
4
|
+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
|
|
5
|
+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
|
|
6
|
+
|
|
7
|
+
const account = new Account(client);
|
|
8
|
+
|
|
9
|
+
const result = await account.createEmailVerification({
|
|
10
|
+
url: 'https://example.com'
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
console.log(result);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Client, Account } from "react-native-appwrite";
|
|
2
|
+
|
|
3
|
+
const client = new Client()
|
|
4
|
+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
|
|
5
|
+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
|
|
6
|
+
|
|
7
|
+
const account = new Account(client);
|
|
8
|
+
|
|
9
|
+
const result = await account.updateEmailVerification({
|
|
10
|
+
userId: '<USER_ID>',
|
|
11
|
+
secret: '<SECRET>'
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
console.log(result);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "react-native-appwrite",
|
|
3
3
|
"homepage": "https://appwrite.io/support",
|
|
4
4
|
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.16.0",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "dist/cjs/sdk.js",
|
|
8
8
|
"exports": {
|
package/src/client.ts
CHANGED
package/src/models.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { ExecutionTrigger } from "./enums/execution-trigger"
|
|
2
|
+
import { ExecutionStatus } from "./enums/execution-status"
|
|
3
|
+
|
|
1
4
|
export namespace Models {
|
|
2
5
|
|
|
3
6
|
declare const __default: unique symbol;
|
|
@@ -1008,11 +1011,11 @@ export namespace Models {
|
|
|
1008
1011
|
/**
|
|
1009
1012
|
* The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`.
|
|
1010
1013
|
*/
|
|
1011
|
-
trigger:
|
|
1014
|
+
trigger: ExecutionTrigger;
|
|
1012
1015
|
/**
|
|
1013
1016
|
* The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`.
|
|
1014
1017
|
*/
|
|
1015
|
-
status:
|
|
1018
|
+
status: ExecutionStatus;
|
|
1016
1019
|
/**
|
|
1017
1020
|
* HTTP request method type.
|
|
1018
1021
|
*/
|
package/src/services/account.ts
CHANGED
|
@@ -2427,6 +2427,62 @@ export class Account extends Service {
|
|
|
2427
2427
|
* @throws {AppwriteException}
|
|
2428
2428
|
* @returns {Promise}
|
|
2429
2429
|
*/
|
|
2430
|
+
createEmailVerification(params: { url: string }): Promise<Models.Token>;
|
|
2431
|
+
/**
|
|
2432
|
+
* Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.
|
|
2433
|
+
*
|
|
2434
|
+
* Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
|
|
2435
|
+
*
|
|
2436
|
+
*
|
|
2437
|
+
* @param {string} url - URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
2438
|
+
* @throws {AppwriteException}
|
|
2439
|
+
* @returns {Promise<Models.Token>}
|
|
2440
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2441
|
+
*/
|
|
2442
|
+
createEmailVerification(url: string): Promise<Models.Token>;
|
|
2443
|
+
createEmailVerification(
|
|
2444
|
+
paramsOrFirst: { url: string } | string
|
|
2445
|
+
): Promise<Models.Token> {
|
|
2446
|
+
let params: { url: string };
|
|
2447
|
+
|
|
2448
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2449
|
+
params = (paramsOrFirst || {}) as { url: string };
|
|
2450
|
+
} else {
|
|
2451
|
+
params = {
|
|
2452
|
+
url: paramsOrFirst as string
|
|
2453
|
+
};
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
const url = params.url;
|
|
2457
|
+
|
|
2458
|
+
if (typeof url === 'undefined') {
|
|
2459
|
+
throw new AppwriteException('Missing required parameter: "url"');
|
|
2460
|
+
}
|
|
2461
|
+
|
|
2462
|
+
const apiPath = '/account/verifications/email';
|
|
2463
|
+
const payload: Payload = {};
|
|
2464
|
+
|
|
2465
|
+
if (typeof url !== 'undefined') {
|
|
2466
|
+
payload['url'] = url;
|
|
2467
|
+
}
|
|
2468
|
+
|
|
2469
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2470
|
+
return this.client.call('post', uri, {
|
|
2471
|
+
'content-type': 'application/json',
|
|
2472
|
+
}, payload);
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
/**
|
|
2476
|
+
* Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.
|
|
2477
|
+
*
|
|
2478
|
+
* Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
|
|
2479
|
+
*
|
|
2480
|
+
*
|
|
2481
|
+
* @param {string} params.url - URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
2482
|
+
* @throws {AppwriteException}
|
|
2483
|
+
* @returns {Promise}
|
|
2484
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.createEmailVerification` instead.
|
|
2485
|
+
*/
|
|
2430
2486
|
createVerification(params: { url: string }): Promise<Models.Token>;
|
|
2431
2487
|
/**
|
|
2432
2488
|
* Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.
|
|
@@ -2459,7 +2515,7 @@ export class Account extends Service {
|
|
|
2459
2515
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
2460
2516
|
}
|
|
2461
2517
|
|
|
2462
|
-
const apiPath = '/account/
|
|
2518
|
+
const apiPath = '/account/verifications/email';
|
|
2463
2519
|
const payload: Payload = {};
|
|
2464
2520
|
|
|
2465
2521
|
if (typeof url !== 'undefined') {
|
|
@@ -2480,6 +2536,69 @@ export class Account extends Service {
|
|
|
2480
2536
|
* @throws {AppwriteException}
|
|
2481
2537
|
* @returns {Promise}
|
|
2482
2538
|
*/
|
|
2539
|
+
updateEmailVerification(params: { userId: string, secret: string }): Promise<Models.Token>;
|
|
2540
|
+
/**
|
|
2541
|
+
* Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
|
|
2542
|
+
*
|
|
2543
|
+
* @param {string} userId - User ID.
|
|
2544
|
+
* @param {string} secret - Valid verification token.
|
|
2545
|
+
* @throws {AppwriteException}
|
|
2546
|
+
* @returns {Promise<Models.Token>}
|
|
2547
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2548
|
+
*/
|
|
2549
|
+
updateEmailVerification(userId: string, secret: string): Promise<Models.Token>;
|
|
2550
|
+
updateEmailVerification(
|
|
2551
|
+
paramsOrFirst: { userId: string, secret: string } | string,
|
|
2552
|
+
...rest: [(string)?]
|
|
2553
|
+
): Promise<Models.Token> {
|
|
2554
|
+
let params: { userId: string, secret: string };
|
|
2555
|
+
|
|
2556
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2557
|
+
params = (paramsOrFirst || {}) as { userId: string, secret: string };
|
|
2558
|
+
} else {
|
|
2559
|
+
params = {
|
|
2560
|
+
userId: paramsOrFirst as string,
|
|
2561
|
+
secret: rest[0] as string
|
|
2562
|
+
};
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2565
|
+
const userId = params.userId;
|
|
2566
|
+
const secret = params.secret;
|
|
2567
|
+
|
|
2568
|
+
if (typeof userId === 'undefined') {
|
|
2569
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2572
|
+
if (typeof secret === 'undefined') {
|
|
2573
|
+
throw new AppwriteException('Missing required parameter: "secret"');
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
const apiPath = '/account/verifications/email';
|
|
2577
|
+
const payload: Payload = {};
|
|
2578
|
+
|
|
2579
|
+
if (typeof userId !== 'undefined') {
|
|
2580
|
+
payload['userId'] = userId;
|
|
2581
|
+
}
|
|
2582
|
+
|
|
2583
|
+
if (typeof secret !== 'undefined') {
|
|
2584
|
+
payload['secret'] = secret;
|
|
2585
|
+
}
|
|
2586
|
+
|
|
2587
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2588
|
+
return this.client.call('put', uri, {
|
|
2589
|
+
'content-type': 'application/json',
|
|
2590
|
+
}, payload);
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
/**
|
|
2594
|
+
* Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
|
|
2595
|
+
*
|
|
2596
|
+
* @param {string} params.userId - User ID.
|
|
2597
|
+
* @param {string} params.secret - Valid verification token.
|
|
2598
|
+
* @throws {AppwriteException}
|
|
2599
|
+
* @returns {Promise}
|
|
2600
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateEmailVerification` instead.
|
|
2601
|
+
*/
|
|
2483
2602
|
updateVerification(params: { userId: string, secret: string }): Promise<Models.Token>;
|
|
2484
2603
|
/**
|
|
2485
2604
|
* Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
|
|
@@ -2517,7 +2636,7 @@ export class Account extends Service {
|
|
|
2517
2636
|
throw new AppwriteException('Missing required parameter: "secret"');
|
|
2518
2637
|
}
|
|
2519
2638
|
|
|
2520
|
-
const apiPath = '/account/
|
|
2639
|
+
const apiPath = '/account/verifications/email';
|
|
2521
2640
|
const payload: Payload = {};
|
|
2522
2641
|
|
|
2523
2642
|
if (typeof userId !== 'undefined') {
|
|
@@ -2541,7 +2660,7 @@ export class Account extends Service {
|
|
|
2541
2660
|
* @returns {Promise}
|
|
2542
2661
|
*/
|
|
2543
2662
|
createPhoneVerification(): Promise<Models.Token> {
|
|
2544
|
-
const apiPath = '/account/
|
|
2663
|
+
const apiPath = '/account/verifications/phone';
|
|
2545
2664
|
const payload: Payload = {};
|
|
2546
2665
|
|
|
2547
2666
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -2595,7 +2714,7 @@ export class Account extends Service {
|
|
|
2595
2714
|
throw new AppwriteException('Missing required parameter: "secret"');
|
|
2596
2715
|
}
|
|
2597
2716
|
|
|
2598
|
-
const apiPath = '/account/
|
|
2717
|
+
const apiPath = '/account/verifications/phone';
|
|
2599
2718
|
const payload: Payload = {};
|
|
2600
2719
|
|
|
2601
2720
|
if (typeof userId !== 'undefined') {
|
|
@@ -17,7 +17,7 @@ export class TablesDB extends Service {
|
|
|
17
17
|
* Get a list of all the user's rows in a given table. You can use the query params to filter your results.
|
|
18
18
|
*
|
|
19
19
|
* @param {string} params.databaseId - Database ID.
|
|
20
|
-
* @param {string} params.tableId - Table ID. You can create a new table using the
|
|
20
|
+
* @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table).
|
|
21
21
|
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
|
|
22
22
|
* @throws {AppwriteException}
|
|
23
23
|
* @returns {Promise}
|
|
@@ -27,7 +27,7 @@ export class TablesDB extends Service {
|
|
|
27
27
|
* Get a list of all the user's rows in a given table. You can use the query params to filter your results.
|
|
28
28
|
*
|
|
29
29
|
* @param {string} databaseId - Database ID.
|
|
30
|
-
* @param {string} tableId - Table ID. You can create a new table using the
|
|
30
|
+
* @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table).
|
|
31
31
|
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
|
|
32
32
|
* @throws {AppwriteException}
|
|
33
33
|
* @returns {Promise<Models.RowList<Row>>}
|
|
@@ -75,10 +75,10 @@ export class TablesDB extends Service {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
|
-
* Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/
|
|
78
|
+
* Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console.
|
|
79
79
|
*
|
|
80
80
|
* @param {string} params.databaseId - Database ID.
|
|
81
|
-
* @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/
|
|
81
|
+
* @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows.
|
|
82
82
|
* @param {string} params.rowId - Row ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
83
83
|
* @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>} params.data - Row data as JSON object.
|
|
84
84
|
* @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
@@ -87,10 +87,10 @@ export class TablesDB extends Service {
|
|
|
87
87
|
*/
|
|
88
88
|
createRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[] }): Promise<Row>;
|
|
89
89
|
/**
|
|
90
|
-
* Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/
|
|
90
|
+
* Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console.
|
|
91
91
|
*
|
|
92
92
|
* @param {string} databaseId - Database ID.
|
|
93
|
-
* @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/
|
|
93
|
+
* @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows.
|
|
94
94
|
* @param {string} rowId - Row ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
95
95
|
* @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>} data - Row data as JSON object.
|
|
96
96
|
* @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
@@ -164,7 +164,7 @@ export class TablesDB extends Service {
|
|
|
164
164
|
* Get a row by its unique ID. This endpoint response returns a JSON object with the row data.
|
|
165
165
|
*
|
|
166
166
|
* @param {string} params.databaseId - Database ID.
|
|
167
|
-
* @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/
|
|
167
|
+
* @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
|
|
168
168
|
* @param {string} params.rowId - Row ID.
|
|
169
169
|
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
|
|
170
170
|
* @throws {AppwriteException}
|
|
@@ -175,7 +175,7 @@ export class TablesDB extends Service {
|
|
|
175
175
|
* Get a row by its unique ID. This endpoint response returns a JSON object with the row data.
|
|
176
176
|
*
|
|
177
177
|
* @param {string} databaseId - Database ID.
|
|
178
|
-
* @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/
|
|
178
|
+
* @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
|
|
179
179
|
* @param {string} rowId - Row ID.
|
|
180
180
|
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
|
|
181
181
|
* @throws {AppwriteException}
|
|
@@ -230,7 +230,7 @@ export class TablesDB extends Service {
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
/**
|
|
233
|
-
* Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/
|
|
233
|
+
* Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console.
|
|
234
234
|
*
|
|
235
235
|
* @param {string} params.databaseId - Database ID.
|
|
236
236
|
* @param {string} params.tableId - Table ID.
|
|
@@ -242,7 +242,7 @@ export class TablesDB extends Service {
|
|
|
242
242
|
*/
|
|
243
243
|
upsertRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[] }): Promise<Row>;
|
|
244
244
|
/**
|
|
245
|
-
* Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/
|
|
245
|
+
* Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console.
|
|
246
246
|
*
|
|
247
247
|
* @param {string} databaseId - Database ID.
|
|
248
248
|
* @param {string} tableId - Table ID.
|
|
@@ -389,7 +389,7 @@ export class TablesDB extends Service {
|
|
|
389
389
|
* Delete a row by its unique ID.
|
|
390
390
|
*
|
|
391
391
|
* @param {string} params.databaseId - Database ID.
|
|
392
|
-
* @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/
|
|
392
|
+
* @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
|
|
393
393
|
* @param {string} params.rowId - Row ID.
|
|
394
394
|
* @throws {AppwriteException}
|
|
395
395
|
* @returns {Promise}
|
|
@@ -399,7 +399,7 @@ export class TablesDB extends Service {
|
|
|
399
399
|
* Delete a row by its unique ID.
|
|
400
400
|
*
|
|
401
401
|
* @param {string} databaseId - Database ID.
|
|
402
|
-
* @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/
|
|
402
|
+
* @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
|
|
403
403
|
* @param {string} rowId - Row ID.
|
|
404
404
|
* @throws {AppwriteException}
|
|
405
405
|
* @returns {Promise<{}>}
|
package/types/models.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ExecutionTrigger } from "./enums/execution-trigger";
|
|
2
|
+
import { ExecutionStatus } from "./enums/execution-status";
|
|
1
3
|
export declare namespace Models {
|
|
2
4
|
const __default: unique symbol;
|
|
3
5
|
/**
|
|
@@ -966,11 +968,11 @@ export declare namespace Models {
|
|
|
966
968
|
/**
|
|
967
969
|
* The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`.
|
|
968
970
|
*/
|
|
969
|
-
trigger:
|
|
971
|
+
trigger: ExecutionTrigger;
|
|
970
972
|
/**
|
|
971
973
|
* The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`.
|
|
972
974
|
*/
|
|
973
|
-
status:
|
|
975
|
+
status: ExecutionStatus;
|
|
974
976
|
/**
|
|
975
977
|
* HTTP request method type.
|
|
976
978
|
*/
|
|
@@ -977,6 +977,32 @@ export declare class Account extends Service {
|
|
|
977
977
|
* @throws {AppwriteException}
|
|
978
978
|
* @returns {Promise}
|
|
979
979
|
*/
|
|
980
|
+
createEmailVerification(params: {
|
|
981
|
+
url: string;
|
|
982
|
+
}): Promise<Models.Token>;
|
|
983
|
+
/**
|
|
984
|
+
* Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.
|
|
985
|
+
*
|
|
986
|
+
* Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
|
|
987
|
+
*
|
|
988
|
+
*
|
|
989
|
+
* @param {string} url - URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
990
|
+
* @throws {AppwriteException}
|
|
991
|
+
* @returns {Promise<Models.Token>}
|
|
992
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
993
|
+
*/
|
|
994
|
+
createEmailVerification(url: string): Promise<Models.Token>;
|
|
995
|
+
/**
|
|
996
|
+
* Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.
|
|
997
|
+
*
|
|
998
|
+
* Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
|
|
999
|
+
*
|
|
1000
|
+
*
|
|
1001
|
+
* @param {string} params.url - URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
1002
|
+
* @throws {AppwriteException}
|
|
1003
|
+
* @returns {Promise}
|
|
1004
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.createEmailVerification` instead.
|
|
1005
|
+
*/
|
|
980
1006
|
createVerification(params: {
|
|
981
1007
|
url: string;
|
|
982
1008
|
}): Promise<Models.Token>;
|
|
@@ -1000,6 +1026,29 @@ export declare class Account extends Service {
|
|
|
1000
1026
|
* @throws {AppwriteException}
|
|
1001
1027
|
* @returns {Promise}
|
|
1002
1028
|
*/
|
|
1029
|
+
updateEmailVerification(params: {
|
|
1030
|
+
userId: string;
|
|
1031
|
+
secret: string;
|
|
1032
|
+
}): Promise<Models.Token>;
|
|
1033
|
+
/**
|
|
1034
|
+
* Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
|
|
1035
|
+
*
|
|
1036
|
+
* @param {string} userId - User ID.
|
|
1037
|
+
* @param {string} secret - Valid verification token.
|
|
1038
|
+
* @throws {AppwriteException}
|
|
1039
|
+
* @returns {Promise<Models.Token>}
|
|
1040
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1041
|
+
*/
|
|
1042
|
+
updateEmailVerification(userId: string, secret: string): Promise<Models.Token>;
|
|
1043
|
+
/**
|
|
1044
|
+
* Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
|
|
1045
|
+
*
|
|
1046
|
+
* @param {string} params.userId - User ID.
|
|
1047
|
+
* @param {string} params.secret - Valid verification token.
|
|
1048
|
+
* @throws {AppwriteException}
|
|
1049
|
+
* @returns {Promise}
|
|
1050
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateEmailVerification` instead.
|
|
1051
|
+
*/
|
|
1003
1052
|
updateVerification(params: {
|
|
1004
1053
|
userId: string;
|
|
1005
1054
|
secret: string;
|
|
@@ -7,7 +7,7 @@ export declare class TablesDB extends Service {
|
|
|
7
7
|
* Get a list of all the user's rows in a given table. You can use the query params to filter your results.
|
|
8
8
|
*
|
|
9
9
|
* @param {string} params.databaseId - Database ID.
|
|
10
|
-
* @param {string} params.tableId - Table ID. You can create a new table using the
|
|
10
|
+
* @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table).
|
|
11
11
|
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
|
|
12
12
|
* @throws {AppwriteException}
|
|
13
13
|
* @returns {Promise}
|
|
@@ -21,7 +21,7 @@ export declare class TablesDB extends Service {
|
|
|
21
21
|
* Get a list of all the user's rows in a given table. You can use the query params to filter your results.
|
|
22
22
|
*
|
|
23
23
|
* @param {string} databaseId - Database ID.
|
|
24
|
-
* @param {string} tableId - Table ID. You can create a new table using the
|
|
24
|
+
* @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table).
|
|
25
25
|
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
|
|
26
26
|
* @throws {AppwriteException}
|
|
27
27
|
* @returns {Promise<Models.RowList<Row>>}
|
|
@@ -29,10 +29,10 @@ export declare class TablesDB extends Service {
|
|
|
29
29
|
*/
|
|
30
30
|
listRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, queries?: string[]): Promise<Models.RowList<Row>>;
|
|
31
31
|
/**
|
|
32
|
-
* Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/
|
|
32
|
+
* Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console.
|
|
33
33
|
*
|
|
34
34
|
* @param {string} params.databaseId - Database ID.
|
|
35
|
-
* @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/
|
|
35
|
+
* @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows.
|
|
36
36
|
* @param {string} params.rowId - Row ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
37
37
|
* @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>} params.data - Row data as JSON object.
|
|
38
38
|
* @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
@@ -47,10 +47,10 @@ export declare class TablesDB extends Service {
|
|
|
47
47
|
permissions?: string[];
|
|
48
48
|
}): Promise<Row>;
|
|
49
49
|
/**
|
|
50
|
-
* Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/
|
|
50
|
+
* Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console.
|
|
51
51
|
*
|
|
52
52
|
* @param {string} databaseId - Database ID.
|
|
53
|
-
* @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/
|
|
53
|
+
* @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows.
|
|
54
54
|
* @param {string} rowId - Row ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
55
55
|
* @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>} data - Row data as JSON object.
|
|
56
56
|
* @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
@@ -63,7 +63,7 @@ export declare class TablesDB extends Service {
|
|
|
63
63
|
* Get a row by its unique ID. This endpoint response returns a JSON object with the row data.
|
|
64
64
|
*
|
|
65
65
|
* @param {string} params.databaseId - Database ID.
|
|
66
|
-
* @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/
|
|
66
|
+
* @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
|
|
67
67
|
* @param {string} params.rowId - Row ID.
|
|
68
68
|
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
|
|
69
69
|
* @throws {AppwriteException}
|
|
@@ -79,7 +79,7 @@ export declare class TablesDB extends Service {
|
|
|
79
79
|
* Get a row by its unique ID. This endpoint response returns a JSON object with the row data.
|
|
80
80
|
*
|
|
81
81
|
* @param {string} databaseId - Database ID.
|
|
82
|
-
* @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/
|
|
82
|
+
* @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
|
|
83
83
|
* @param {string} rowId - Row ID.
|
|
84
84
|
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
|
|
85
85
|
* @throws {AppwriteException}
|
|
@@ -88,7 +88,7 @@ export declare class TablesDB extends Service {
|
|
|
88
88
|
*/
|
|
89
89
|
getRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, queries?: string[]): Promise<Row>;
|
|
90
90
|
/**
|
|
91
|
-
* Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/
|
|
91
|
+
* Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console.
|
|
92
92
|
*
|
|
93
93
|
* @param {string} params.databaseId - Database ID.
|
|
94
94
|
* @param {string} params.tableId - Table ID.
|
|
@@ -106,7 +106,7 @@ export declare class TablesDB extends Service {
|
|
|
106
106
|
permissions?: string[];
|
|
107
107
|
}): Promise<Row>;
|
|
108
108
|
/**
|
|
109
|
-
* Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/
|
|
109
|
+
* Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console.
|
|
110
110
|
*
|
|
111
111
|
* @param {string} databaseId - Database ID.
|
|
112
112
|
* @param {string} tableId - Table ID.
|
|
@@ -153,7 +153,7 @@ export declare class TablesDB extends Service {
|
|
|
153
153
|
* Delete a row by its unique ID.
|
|
154
154
|
*
|
|
155
155
|
* @param {string} params.databaseId - Database ID.
|
|
156
|
-
* @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/
|
|
156
|
+
* @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
|
|
157
157
|
* @param {string} params.rowId - Row ID.
|
|
158
158
|
* @throws {AppwriteException}
|
|
159
159
|
* @returns {Promise}
|
|
@@ -167,7 +167,7 @@ export declare class TablesDB extends Service {
|
|
|
167
167
|
* Delete a row by its unique ID.
|
|
168
168
|
*
|
|
169
169
|
* @param {string} databaseId - Database ID.
|
|
170
|
-
* @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/
|
|
170
|
+
* @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
|
|
171
171
|
* @param {string} rowId - Row ID.
|
|
172
172
|
* @throws {AppwriteException}
|
|
173
173
|
* @returns {Promise<{}>}
|