Skip to content

Commit b94c5a3

Browse files
committed
chore: regen
1 parent cfa0f66 commit b94c5a3

File tree

9 files changed

+220
-61
lines changed

9 files changed

+220
-61
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Log
22

3+
## 20.0.1
4+
5+
* Deprecate `createVerification` method in `Account` service
6+
* Add `createEmailVerification` method in `Account` service
7+
38
## 17.2.0
49

510
* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const sdk = require('node-appwrite');
2+
3+
const client = new sdk.Client()
4+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('<YOUR_PROJECT_ID>') // Your project ID
6+
.setSession(''); // The user session to authenticate with
7+
8+
const account = new sdk.Account(client);
9+
10+
const result = await account.createEmailVerification({
11+
url: 'https://example.com'
12+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const sdk = require('node-appwrite');
2+
3+
const client = new sdk.Client()
4+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('<YOUR_PROJECT_ID>') // Your project ID
6+
.setSession(''); // The user session to authenticate with
7+
8+
const account = new sdk.Account(client);
9+
10+
const result = await account.updateEmailVerification({
11+
userId: '<USER_ID>',
12+
secret: '<SECRET>'
13+
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "node-appwrite",
33
"homepage": "https://appwrite.io/support",
44
"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": "20.0.0",
5+
"version": "20.0.1",
66
"license": "BSD-3-Clause",
77
"main": "dist/index.js",
88
"type": "commonjs",

src/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class AppwriteException extends Error {
3333
}
3434

3535
function getUserAgent() {
36-
let ua = 'AppwriteNodeJSSDK/20.0.0';
36+
let ua = 'AppwriteNodeJSSDK/20.0.1';
3737

3838
// `process` is a global in Node.js, but not fully available in all runtimes.
3939
const platform: string[] = [];
@@ -82,7 +82,7 @@ class Client {
8282
'x-sdk-name': 'Node.js',
8383
'x-sdk-platform': 'server',
8484
'x-sdk-language': 'nodejs',
85-
'x-sdk-version': '20.0.0',
85+
'x-sdk-version': '20.0.1',
8686
'user-agent' : getUserAgent(),
8787
'X-Appwrite-Response-Format': '1.8.0',
8888
};

src/services/account.ts

Lines changed: 133 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2448,6 +2448,68 @@ export class Account {
24482448
* @throws {AppwriteException}
24492449
* @returns {Promise<Models.Token>}
24502450
*/
2451+
createEmailVerification(params: { url: string }): Promise<Models.Token>;
2452+
/**
2453+
* 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.
2454+
*
2455+
* 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.
2456+
*
2457+
*
2458+
* @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.
2459+
* @throws {AppwriteException}
2460+
* @returns {Promise<Models.Token>}
2461+
* @deprecated Use the object parameter style method for a better developer experience.
2462+
*/
2463+
createEmailVerification(url: string): Promise<Models.Token>;
2464+
createEmailVerification(
2465+
paramsOrFirst: { url: string } | string
2466+
): Promise<Models.Token> {
2467+
let params: { url: string };
2468+
2469+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2470+
params = (paramsOrFirst || {}) as { url: string };
2471+
} else {
2472+
params = {
2473+
url: paramsOrFirst as string
2474+
};
2475+
}
2476+
2477+
const url = params.url;
2478+
2479+
if (typeof url === 'undefined') {
2480+
throw new AppwriteException('Missing required parameter: "url"');
2481+
}
2482+
2483+
const apiPath = '/account/verifications/email';
2484+
const payload: Payload = {};
2485+
if (typeof url !== 'undefined') {
2486+
payload['url'] = url;
2487+
}
2488+
const uri = new URL(this.client.config.endpoint + apiPath);
2489+
2490+
const apiHeaders: { [header: string]: string } = {
2491+
'content-type': 'application/json',
2492+
}
2493+
2494+
return this.client.call(
2495+
'post',
2496+
uri,
2497+
apiHeaders,
2498+
payload,
2499+
);
2500+
}
2501+
2502+
/**
2503+
* 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.
2504+
*
2505+
* 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.
2506+
*
2507+
*
2508+
* @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.
2509+
* @throws {AppwriteException}
2510+
* @returns {Promise<Models.Token>}
2511+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.createEmailVerification` instead.
2512+
*/
24512513
createVerification(params: { url: string }): Promise<Models.Token>;
24522514
/**
24532515
* 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.
@@ -2480,7 +2542,7 @@ export class Account {
24802542
throw new AppwriteException('Missing required parameter: "url"');
24812543
}
24822544

2483-
const apiPath = '/account/verification';
2545+
const apiPath = '/account/verifications/email';
24842546
const payload: Payload = {};
24852547
if (typeof url !== 'undefined') {
24862548
payload['url'] = url;
@@ -2507,6 +2569,73 @@ export class Account {
25072569
* @throws {AppwriteException}
25082570
* @returns {Promise<Models.Token>}
25092571
*/
2572+
updateEmailVerification(params: { userId: string, secret: string }): Promise<Models.Token>;
2573+
/**
2574+
* 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.
2575+
*
2576+
* @param {string} userId - User ID.
2577+
* @param {string} secret - Valid verification token.
2578+
* @throws {AppwriteException}
2579+
* @returns {Promise<Models.Token>}
2580+
* @deprecated Use the object parameter style method for a better developer experience.
2581+
*/
2582+
updateEmailVerification(userId: string, secret: string): Promise<Models.Token>;
2583+
updateEmailVerification(
2584+
paramsOrFirst: { userId: string, secret: string } | string,
2585+
...rest: [(string)?]
2586+
): Promise<Models.Token> {
2587+
let params: { userId: string, secret: string };
2588+
2589+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2590+
params = (paramsOrFirst || {}) as { userId: string, secret: string };
2591+
} else {
2592+
params = {
2593+
userId: paramsOrFirst as string,
2594+
secret: rest[0] as string
2595+
};
2596+
}
2597+
2598+
const userId = params.userId;
2599+
const secret = params.secret;
2600+
2601+
if (typeof userId === 'undefined') {
2602+
throw new AppwriteException('Missing required parameter: "userId"');
2603+
}
2604+
if (typeof secret === 'undefined') {
2605+
throw new AppwriteException('Missing required parameter: "secret"');
2606+
}
2607+
2608+
const apiPath = '/account/verifications/email';
2609+
const payload: Payload = {};
2610+
if (typeof userId !== 'undefined') {
2611+
payload['userId'] = userId;
2612+
}
2613+
if (typeof secret !== 'undefined') {
2614+
payload['secret'] = secret;
2615+
}
2616+
const uri = new URL(this.client.config.endpoint + apiPath);
2617+
2618+
const apiHeaders: { [header: string]: string } = {
2619+
'content-type': 'application/json',
2620+
}
2621+
2622+
return this.client.call(
2623+
'put',
2624+
uri,
2625+
apiHeaders,
2626+
payload,
2627+
);
2628+
}
2629+
2630+
/**
2631+
* 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.
2632+
*
2633+
* @param {string} params.userId - User ID.
2634+
* @param {string} params.secret - Valid verification token.
2635+
* @throws {AppwriteException}
2636+
* @returns {Promise<Models.Token>}
2637+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateEmailVerification` instead.
2638+
*/
25102639
updateVerification(params: { userId: string, secret: string }): Promise<Models.Token>;
25112640
/**
25122641
* 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.
@@ -2543,7 +2672,7 @@ export class Account {
25432672
throw new AppwriteException('Missing required parameter: "secret"');
25442673
}
25452674

2546-
const apiPath = '/account/verification';
2675+
const apiPath = '/account/verifications/email';
25472676
const payload: Payload = {};
25482677
if (typeof userId !== 'undefined') {
25492678
payload['userId'] = userId;
@@ -2573,7 +2702,7 @@ export class Account {
25732702
*/
25742703
createPhoneVerification(): Promise<Models.Token> {
25752704

2576-
const apiPath = '/account/verification/phone';
2705+
const apiPath = '/account/verifications/phone';
25772706
const payload: Payload = {};
25782707
const uri = new URL(this.client.config.endpoint + apiPath);
25792708

@@ -2633,7 +2762,7 @@ export class Account {
26332762
throw new AppwriteException('Missing required parameter: "secret"');
26342763
}
26352764

2636-
const apiPath = '/account/verification/phone';
2765+
const apiPath = '/account/verifications/phone';
26372766
const payload: Payload = {};
26382767
if (typeof userId !== 'undefined') {
26392768
payload['userId'] = userId;

src/services/functions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ export class Functions {
878878
/**
879879
* Create a deployment based on a template.
880880
*
881-
* Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to find the template details.
881+
* Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/functions/templates) to find the template details.
882882
*
883883
* @param {string} params.functionId - Function ID.
884884
* @param {string} params.repository - Repository name of the template.
@@ -893,7 +893,7 @@ export class Functions {
893893
/**
894894
* Create a deployment based on a template.
895895
*
896-
* Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to find the template details.
896+
* Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/functions/templates) to find the template details.
897897
*
898898
* @param {string} functionId - Function ID.
899899
* @param {string} repository - Repository name of the template.

src/services/sites.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ export class Sites {
877877
/**
878878
* Create a deployment based on a template.
879879
*
880-
* Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to find the template details.
880+
* Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/sites/templates) to find the template details.
881881
*
882882
* @param {string} params.siteId - Site ID.
883883
* @param {string} params.repository - Repository name of the template.
@@ -892,7 +892,7 @@ export class Sites {
892892
/**
893893
* Create a deployment based on a template.
894894
*
895-
* Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to find the template details.
895+
* Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/sites/templates) to find the template details.
896896
*
897897
* @param {string} siteId - Site ID.
898898
* @param {string} repository - Repository name of the template.

0 commit comments

Comments
 (0)