Skip to content

Commit ec7998e

Browse files
authored
Merge pull request #130 from appwrite/dev
feat: Node.js SDK update for version 21.0.0
2 parents 04e54c6 + cfca36d commit ec7998e

30 files changed

+828
-96
lines changed

CHANGELOG.md

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

3+
## 21.0.0
4+
5+
* Rename `VCSDeploymentType` enum to `VCSReferenceType`
6+
* Change `createTemplateDeployment` method signature: replace `version` parameter with `type` (TemplateReferenceType) and `reference` parameters
7+
* Add `getScreenshot` method to `Avatars` service
8+
* Add `Theme`, `Timezone` and `Output` enums
9+
310
## 20.3.0
411

512
* Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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 avatars = new sdk.Avatars(client);
9+
10+
const result = await avatars.getScreenshot({
11+
url: 'https://example.com',
12+
headers: {
13+
"Authorization": "Bearer token123",
14+
"X-Custom-Header": "value"
15+
}, // optional
16+
viewportWidth: 1920, // optional
17+
viewportHeight: 1080, // optional
18+
scale: 2, // optional
19+
theme: sdk.Theme.Light, // optional
20+
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // optional
21+
fullpage: true, // optional
22+
locale: 'en-US', // optional
23+
timezone: sdk.Timezone.AfricaAbidjan, // optional
24+
latitude: 37.7749, // optional
25+
longitude: -122.4194, // optional
26+
accuracy: 100, // optional
27+
touch: true, // optional
28+
permissions: ["geolocation","notifications"], // optional
29+
sleep: 3, // optional
30+
width: 800, // optional
31+
height: 600, // optional
32+
quality: 85, // optional
33+
output: sdk.Output.Jpg // optional
34+
});

docs/examples/functions/create-template-deployment.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const result = await functions.createTemplateDeployment({
1212
repository: '<REPOSITORY>',
1313
owner: '<OWNER>',
1414
rootDirectory: '<ROOT_DIRECTORY>',
15-
version: '<VERSION>',
15+
type: sdk.TemplateReferenceType.Commit,
16+
reference: '<REFERENCE>',
1617
activate: false // optional
1718
});

docs/examples/functions/create-vcs-deployment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const functions = new sdk.Functions(client);
99

1010
const result = await functions.createVcsDeployment({
1111
functionId: '<FUNCTION_ID>',
12-
type: sdk.VCSDeploymentType.Branch,
12+
type: sdk.VCSReferenceType.Branch,
1313
reference: '<REFERENCE>',
1414
activate: false // optional
1515
});

docs/examples/functions/create.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const functions = new sdk.Functions(client);
1010
const result = await functions.create({
1111
functionId: '<FUNCTION_ID>',
1212
name: '<NAME>',
13-
runtime: sdk..Node145,
13+
runtime: sdk.Runtime.Node145,
1414
execute: ["any"], // optional
1515
events: [], // optional
1616
schedule: '', // optional

docs/examples/functions/update.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const functions = new sdk.Functions(client);
1010
const result = await functions.update({
1111
functionId: '<FUNCTION_ID>',
1212
name: '<NAME>',
13-
runtime: sdk..Node145, // optional
13+
runtime: sdk.Runtime.Node145, // optional
1414
execute: ["any"], // optional
1515
events: [], // optional
1616
schedule: '', // optional

docs/examples/health/get-failed-jobs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ const client = new sdk.Client()
88
const health = new sdk.Health(client);
99

1010
const result = await health.getFailedJobs({
11-
name: sdk..V1Database,
11+
name: sdk.Name.V1Database,
1212
threshold: null // optional
1313
});

docs/examples/sites/create-template-deployment.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const result = await sites.createTemplateDeployment({
1212
repository: '<REPOSITORY>',
1313
owner: '<OWNER>',
1414
rootDirectory: '<ROOT_DIRECTORY>',
15-
version: '<VERSION>',
15+
type: sdk.TemplateReferenceType.Branch,
16+
reference: '<REFERENCE>',
1617
activate: false // optional
1718
});

docs/examples/sites/create-vcs-deployment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const sites = new sdk.Sites(client);
99

1010
const result = await sites.createVcsDeployment({
1111
siteId: '<SITE_ID>',
12-
type: sdk.VCSDeploymentType.Branch,
12+
type: sdk.VCSReferenceType.Branch,
1313
reference: '<REFERENCE>',
1414
activate: false // optional
1515
});

docs/examples/sites/create.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ const sites = new sdk.Sites(client);
1010
const result = await sites.create({
1111
siteId: '<SITE_ID>',
1212
name: '<NAME>',
13-
framework: sdk..Analog,
14-
buildRuntime: sdk..Node145,
13+
framework: sdk.Framework.Analog,
14+
buildRuntime: sdk.BuildRuntime.Node145,
1515
enabled: false, // optional
1616
logging: false, // optional
1717
timeout: 1, // optional
1818
installCommand: '<INSTALL_COMMAND>', // optional
1919
buildCommand: '<BUILD_COMMAND>', // optional
2020
outputDirectory: '<OUTPUT_DIRECTORY>', // optional
21-
adapter: sdk..Static, // optional
21+
adapter: sdk.Adapter.Static, // optional
2222
installationId: '<INSTALLATION_ID>', // optional
2323
fallbackFile: '<FALLBACK_FILE>', // optional
2424
providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional

0 commit comments

Comments
 (0)