### Full Example: Initialize SDK and Create User Source: https://github.com/appwrite/sdk-for-node/blob/main/README.md A complete example combining SDK initialization and user creation. This shows the typical workflow for interacting with Appwrite from Node.js. ```javascript const sdk = require('node-appwrite'); let client = new sdk.Client(); client .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key .setSelfSigned() // Use only on dev mode with a self-signed SSL cert ; let users = new sdk.Users(client); let promise = users.create(sdk.ID.unique(), "email@example.com", "+123456789", "password", "Walter O'Brien"); promise.then(function (response) { console.log(response); }, function (error) { console.log(error); }); ``` -------------------------------- ### Install Appwrite Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/README.md Install the Appwrite Node.js SDK using NPM. This command adds the SDK as a dependency to your project. ```bash npm install node-appwrite --save ``` -------------------------------- ### Get Document with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/databases/get-document.md This snippet shows how to initialize the Appwrite client and use the Databases service to get a document. Ensure you replace placeholders with your actual project details, endpoint, and IDs. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setSession(''); // The user session to authenticate with const databases = new sdk.Databases(client); const result = await databases.getDocument({ databaseId: '', collectionId: '', documentId: '', queries: [], // optional transactionId: '' // optional }); ``` -------------------------------- ### Create a New User with Appwrite Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/README.md Create a new user using the Appwrite Users service. This example demonstrates how to make a request and handle the response or errors. ```javascript let users = new sdk.Users(client); let promise = users.create(sdk.ID.unique(), "email@example.com", "+123456789", "password", "Walter O'Brien"); promise.then(function (response) { console.log(response); }, function (error) { console.log(error); }); ``` -------------------------------- ### Get Deployment Details Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/sites/get-deployment.md Retrieves the details of a specific deployment associated with a site. Ensure you have initialized the Appwrite client with your project credentials and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const sites = new sdk.Sites(client); const result = await sites.getDeployment({ siteId: '', deploymentId: '' }); ``` -------------------------------- ### Node.js GraphQL Mutation Example Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/graphql/mutation.md This snippet shows how to initialize the Appwrite client and execute a GraphQL mutation. Ensure you replace placeholders with your actual project details and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const graphql = new sdk.Graphql(client); const result = await graphql.mutation({ query: {} }); ``` -------------------------------- ### Get Queue Builds with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/health/get-queue-builds.md Initializes the Appwrite client with your project credentials and retrieves the current build queue status. The 'threshold' parameter is optional. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const health = new sdk.Health(client); const result = await health.getQueueBuilds({ threshold: null // optional }); ``` -------------------------------- ### Get Project Details Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/project/get.md Initializes the Appwrite client with project credentials and retrieves the project's details. Ensure you replace placeholders with your actual API endpoint, project ID, and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const project = new sdk.Project(client); const result = await project.get(); ``` -------------------------------- ### Update Token Example Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/tokens/update.md Demonstrates how to update an existing token, including setting a new expiration date. Ensure you have initialized the Appwrite client with your project details and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const tokens = new sdk.Tokens(client); const result = await tokens.update({ tokenId: '', expire: '2020-10-15T06:38:00.000+00:00' // optional }); ``` -------------------------------- ### Get Advisor Report with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/advisor/get-report.md Initializes the Appwrite client with your project credentials and retrieves a specific advisor report using its ID. Ensure you have the 'node-appwrite' package installed and replace placeholders with your actual project details and report ID. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const advisor = new sdk.Advisor(client); const result = await advisor.getReport({ reportId: '' }); ``` -------------------------------- ### Initialize Appwrite Client and List Sites Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/sites/list.md Initializes the Appwrite client with your project details and demonstrates how to call the list function for sites. Ensure you replace placeholders with your actual API endpoint, project ID, and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const sites = new sdk.Sites(client); const result = await sites.list({ queries: [], // optional search: '', // optional total: false // optional }); ``` -------------------------------- ### Create Account with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/account/create.md This snippet demonstrates how to initialize the Appwrite client and create a new user account. Ensure you replace placeholders like '', '', and '' with your actual project details. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setSession(''); // The user session to authenticate with const account = new sdk.Account(client); const result = await account.create({ userId: '', email: 'email@example.com', password: '', name: '' // optional }); ``` -------------------------------- ### List Tables with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/tablesdb/list.md Initializes the Appwrite client and demonstrates how to list tables. Ensure you replace placeholders with your actual project details and API key. The 'queries', 'search', and 'total' parameters are optional. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.list({ queries: [], // optional search: '', // optional total: false // optional }); ``` -------------------------------- ### Get Avatar Image using Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/avatars/get-image.md Initializes the Appwrite client and uses the Avatars service to get an image from a URL. The width and height parameters are optional. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setSession(''); // The user session to authenticate with const avatars = new sdk.Avatars(client); const result = await avatars.getImage({ url: 'https://example.com', width: 0, // optional height: 0 // optional }); ``` -------------------------------- ### Get Antivirus Status with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/health/get-antivirus.md Initialize the Appwrite client and use the Health service to get the antivirus status. Ensure you replace placeholders with your actual project details. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const health = new sdk.Health(client); const result = await health.getAntivirus(); ``` -------------------------------- ### List Topics with Appwrite SDK for Node.js Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/messaging/list-topics.md This snippet shows how to initialize the Appwrite client and use the Messaging service to list topics. Ensure you replace placeholders with your actual project details and API key. The 'queries', 'search', and 'total' parameters are optional. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const messaging = new sdk.Messaging(client); const result = await messaging.listTopics({ queries: [], // optional search: '', // optional total: false // optional }); ``` -------------------------------- ### Get Deployment Download with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/sites/get-deployment-download.md Initializes the Appwrite client and retrieves a download link for a specific website deployment. Ensure you replace placeholders with your actual project details and IDs. The 'type' parameter is optional and can specify 'Source' or 'Build' if needed. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const sites = new sdk.Sites(client); const result = await sites.getDeploymentDownload({ siteId: '', deploymentId: '', type: sdk.DeploymentDownloadType.Source // optional }); ``` -------------------------------- ### Get Queue Deletes using Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/health/get-queue-deletes.md Use this snippet to get the number of delete operations in the queue. Ensure you have initialized the Appwrite client with your project details and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const health = new sdk.Health(client); const result = await health.getQueueDeletes({ threshold: null // optional }); ``` -------------------------------- ### Initialize Appwrite Client and List Variables Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/project/list-variables.md Initializes the Appwrite client with your project credentials and then calls the `listVariables` method to retrieve project variables. Ensure you replace placeholders with your actual project details. ```javascript const sdk = require('node-appwrite'); const client = sdk.Client .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const project = new sdk.Project(client); const result = await project.listVariables({ queries: [], // optional total: false // optional }); ``` -------------------------------- ### Get File Preview with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/storage/get-file-preview.md Use this snippet to get a preview of a file. You can specify various optional parameters to control the preview's appearance and format. Ensure you have initialized the Appwrite client and Storage service. ```javascript const sdk = require('node-appwrite'); const client = sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setSession(''); // The user session to authenticate with; const storage = new sdk.Storage(client); const result = await storage.getFilePreview({ bucketId: '', fileId: '', width: 0, // optional height: 0, // optional gravity: sdk.ImageGravity.Center, // optional quality: -1, // optional borderWidth: 0, // optional borderColor: '', // optional borderRadius: 0, // optional opacity: 0, // optional rotation: -360, // optional background: '', // optional output: sdk.ImageFormat.Jpg, // optional token: '' // optional }); ``` -------------------------------- ### Create Documents with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/databases/create-documents.md This snippet demonstrates how to initialize the Appwrite client and use the Databases service to create documents. Ensure you replace placeholders with your actual project details and IDs. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const databases = new sdk.Databases(client); const result = await databases.createDocuments({ databaseId: '', collectionId: '', documents: [], transactionId: '' // optional }); ``` -------------------------------- ### Get Favicon using Appwrite SDK for Node.js Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/avatars/get-favicon.md This snippet shows how to initialize the Appwrite client and use the Avatars service to get a favicon for a specified URL. Ensure you replace placeholders with your actual project ID and API endpoint. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setSession(''); // The user session to authenticate with const avatars = new sdk.Avatars(client); const result = await avatars.getFavicon({ url: 'https://example.com' }); ``` -------------------------------- ### Create Template Deployment with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/sites/create-template-deployment.md Use this snippet to create a new website deployment from a template repository. Ensure your client is initialized with the correct endpoint, project ID, and API key. The `activate` parameter is optional. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const sites = new sdk.Sites(client); const result = await sites.createTemplateDeployment({ siteId: '', repository: '', owner: '', rootDirectory: '', type: sdk.TemplateReferenceType.Branch, reference: '', activate: false // optional }); ``` -------------------------------- ### List Project Keys with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/project/list-keys.md Initialize the Appwrite client with your project credentials and then use the Project service to fetch the list of API keys. Ensure you replace placeholders with your actual project details. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const project = new sdk.Project(client); const result = await project.listKeys({ queries: [], // optional total: false // optional }); ``` -------------------------------- ### Get Bucket Details Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/storage/get-bucket.md Retrieves the details of a specific bucket by its ID. Ensure the client is initialized with your project credentials. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const storage = new sdk.Storage(client); const result = await storage.getBucket({ bucketId: '' }); ``` -------------------------------- ### List Organization Keys with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/organization/list-keys.md Initializes the Appwrite client and demonstrates how to call the listKeys method for an organization. Ensure you replace placeholders with your actual project details and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const organization = new sdk.Organization(client); const result = await organization.listKeys({ queries: [], // optional total: false // optional }); ``` -------------------------------- ### Get a Table Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/tablesdb/get-table.md Retrieves metadata for a specific table. Ensure you have initialized the Appwrite client with your project credentials and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.getTable({ databaseId: '', tableId: '' }); ``` -------------------------------- ### Get Table Index Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/tablesdb/get-index.md Retrieves a specific index from a table. Ensure you have initialized the Appwrite client with your project details and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.getIndex({ databaseId: '', tableId: '', key: '' }); ``` -------------------------------- ### Create a New Site with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/sites/create.md This snippet demonstrates how to create a new site using the Appwrite Node.js SDK. Ensure you have initialized the client with your project details and API key before using this. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const sites = new sdk.Sites(client); const result = await sites.create({ siteId: '', name: '', framework: sdk.Framework.Analog, buildRuntime: sdk.BuildRuntime.Node145, enabled: false, // optional logging: false, // optional timeout: 1, // optional installCommand: '', // optional buildCommand: '', // optional startCommand: '', // optional outputDirectory: '', // optional adapter: sdk.Adapter.Static, // optional installationId: '', // optional fallbackFile: '', // optional providerRepositoryId: '', // optional providerBranch: '', // optional providerSilentMode: false, // optional providerRootDirectory: '', // optional providerBranches: [], // optional providerPaths: [], // optional buildSpecification: '', // optional runtimeSpecification: '', // optional deploymentRetention: 0 // optional }); ``` -------------------------------- ### Get Collection Details Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/databases/get-collection.md Retrieves a specific collection by its ID. Ensure you have initialized the Appwrite client with your project details and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const databases = new sdk.Databases(client); const result = await databases.getCollection({ databaseId: '', collectionId: '' }); ``` -------------------------------- ### List Site Specifications with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/sites/list-specifications.md Initialize the Appwrite client with your project's endpoint, ID, and API key. Then, use the Sites service to call the `listSpecifications` method to retrieve the site's specifications. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const sites = new sdk.Sites(client); const result = await sites.listSpecifications(); ``` -------------------------------- ### Get Afghanistan Flag Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/avatars/get-flag.md Retrieves the flag of Afghanistan using the Avatars service. Ensure the client is configured with your project details and endpoint. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setSession(''); // The user session to authenticate with const avatars = new sdk.Avatars(client); const result = await avatars.getFlag({ code: sdk.Flag.Afghanistan, width: 0, // optional height: 0, // optional quality: -1 // optional }); ``` -------------------------------- ### List Files in a Bucket (Node.js) Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/storage/list-files.md Initializes the Appwrite client and lists files in a specified bucket. Ensure you replace placeholders like '', '', '', and '' with your actual values. The `queries`, `search`, and `total` parameters are optional. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setSession(''); // The user session to authenticate with const storage = new sdk.Storage(client); const result = await storage.listFiles({ bucketId: '', queries: [], // optional search: '', // optional total: false // optional }); ``` -------------------------------- ### Get Team Preferences with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/teams/get-prefs.md Retrieves the preferences for a given team. Ensure you have initialized the Appwrite client with your project details and session. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setSession(''); // The user session to authenticate with const teams = new sdk.Teams(client); const result = await teams.getPrefs({ teamId: '' }); ``` -------------------------------- ### Get Transaction by ID Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/tablesdb/get-transaction.md Use this snippet to retrieve a specific transaction by its ID. Ensure you have initialized the Appwrite client with your project details and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.getTransaction({ transactionId: '' }); ``` -------------------------------- ### Create a New Project with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/organization/create-project.md Initialize the Appwrite client with your project's endpoint, project ID, and API key. Then, use the Organization service to create a new project, optionally specifying a region. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const organization = new sdk.Organization(client); const result = await organization.createProject({ projectId: '', name: '', region: sdk.Region.Fra // optional }); ``` -------------------------------- ### List Projects using Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/organization/list-projects.md This snippet demonstrates how to initialize the Appwrite client, authenticate, and then call the organization.listProjects method. Ensure you replace placeholders like , , , and with your actual values. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const organization = new sdk.Organization(client); const result = await organization.listProjects({ queries: [], // optional search: '', // optional total: false // optional }); ``` -------------------------------- ### Get Site Information Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/sites/get.md Retrieve details for a specific site by its ID. Ensure you have initialized the Appwrite client with your endpoint, project ID, and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const sites = new sdk.Sites(client); const result = await sites.get({ siteId: '' }); ``` -------------------------------- ### List Platforms with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/project/list-platforms.md Initialize the Appwrite client with your project credentials and then call the `listPlatforms` method to retrieve all platforms. Ensure you replace placeholders with your actual API endpoint, project ID, and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const project = new sdk.Project(client); const result = await project.listPlatforms({ queries: [], // optional total: false // optional }); ``` -------------------------------- ### List Buckets with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/storage/list-buckets.md Initializes the Appwrite client and lists all buckets. Ensure you replace placeholders with your actual project details and API key. Optional parameters like 'queries', 'search', and 'total' can be used to filter or modify the results. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const storage = new sdk.Storage(client); const result = await storage.listBuckets({ queries: [], // optional search: '', // optional total: false // optional }); ``` -------------------------------- ### Get Subscriber Details Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/messaging/get-subscriber.md Retrieves the details of a specific subscriber for a given topic. Ensure you have initialized the Appwrite client with your project details and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const messaging = new sdk.Messaging(client); const result = await messaging.getSubscriber({ topicId: '', subscriberId: '' }); ``` -------------------------------- ### Get Queue Functions Status Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/health/get-queue-functions.md Retrieves the status of background functions in the queue. Requires initializing the Appwrite client with your project details and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const health = new sdk.Health(client); const result = await health.getQueueFunctions({ threshold: null // optional }); ``` -------------------------------- ### Create User with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/users/create.md This snippet demonstrates how to initialize the Appwrite client and create a new user. Ensure you replace placeholders like '', '', '', '', and '' with your actual values. The email, phone, password, and name parameters are optional. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const users = new sdk.Users(client); const result = await users.create({ userId: '', email: 'email@example.com', // optional phone: '+12065550100', // optional password: '', // optional name: '' // optional }); ``` -------------------------------- ### Get Queue Certificates Health (Node.js) Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/health/get-queue-certificates.md Retrieves information about the queue certificates. This can be used to monitor the health of certificate-related queues. The `threshold` parameter is optional. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const health = new sdk.Health(client); const result = await health.getQueueCertificates({ threshold: null // optional }); ``` -------------------------------- ### List Databases Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/databases/list.md Initializes the Appwrite client and the Databases service to list all databases. Ensure you replace placeholders with your actual project details and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const databases = new sdk.Databases(client); const result = await databases.list({ queries: [], // optional search: '', // optional total: false // optional }); ``` -------------------------------- ### Get Failed Jobs Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/health/get-failed-jobs.md Retrieves a list of failed jobs for a specified queue. Ensure you have initialized the Appwrite client with your project details and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const health = new sdk.Health(client); const result = await health.getFailedJobs({ name: sdk.HealthQueueName.V1Database, threshold: null // optional }); ``` -------------------------------- ### Get Attribute Details Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/databases/get-attribute.md Retrieves the details of a specific attribute within a collection. Ensure you have initialized the Appwrite client with your project credentials and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const databases = new sdk.Databases(client); const result = await databases.getAttribute({ databaseId: '', collectionId: '', key: '' }); ``` -------------------------------- ### List Identities using Appwrite SDK for Node.js Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/account/list-identities.md Demonstrates how to initialize the Appwrite client and use the `Account.listIdentities` method to fetch identities. Ensure you replace placeholders with your actual project details and session information. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setSession(''); // The user session to authenticate with const account = new sdk.Account(client); const result = await account.listIdentities({ queries: [], // optional total: false // optional }); ``` -------------------------------- ### Get Project Details Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/organization/get-project.md Retrieves the details of a specific project using its ID. Ensure you have initialized the Appwrite client with your endpoint, project ID, and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const organization = new sdk.Organization(client); const result = await organization.getProject({ projectId: '' }); ``` -------------------------------- ### List Frameworks using Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/sites/list-frameworks.md Initialize the Appwrite client with your endpoint, project ID, and API key, then call the listFrameworks method to get a list of supported frameworks. Ensure you replace placeholders with your actual credentials. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const sites = new sdk.Sites(client); const result = await sites.listFrameworks(); ``` -------------------------------- ### Get a Topic by ID Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/messaging/get-topic.md Retrieves a specific topic using its unique identifier. Ensure the client is initialized with your project details and API key before making the call. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const messaging = new sdk.Messaging(client); const result = await messaging.getTopic({ topicId: '' }); ``` -------------------------------- ### List Locale Codes Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/locale/list-codes.md Use the `listCodes` method from the `Locale` service to get all supported locale codes. Ensure you have initialized the Appwrite client with your project details. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setSession(''); // The user session to authenticate with const locale = new sdk.Locale(client); const result = await locale.listCodes(); ``` -------------------------------- ### List User Targets with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/users/list-targets.md This snippet demonstrates how to initialize the Appwrite client and use the Users service to list targets for a given user ID. Ensure you replace placeholders with your actual project details and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const users = new sdk.Users(client); const result = await users.listTargets({ userId: '', queries: [], // optional total: false // optional }); ``` -------------------------------- ### Get Queue Migrations Status Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/health/get-queue-migrations.md Use this snippet to retrieve the status of queue migrations. Ensure you have initialized the Appwrite client with your project details and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const health = new sdk.Health(client); const result = await health.getQueueMigrations({ threshold: null // optional }); ``` -------------------------------- ### Create Linux Platform with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/project/create-linux-platform.md Use this snippet to create a new Linux platform. Ensure you have initialized the Appwrite client with your project's endpoint, ID, and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const project = new sdk.Project(client); const result = await project.createLinuxPlatform({ platformId: '', name: '', packageName: '' }); ``` -------------------------------- ### Get Browser Avatar Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/avatars/get-browser.md Generates a browser avatar icon. You can specify the browser code, dimensions, and quality. Use this to display browser icons within your application. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setSession(''); // The user session to authenticate with const avatars = new sdk.Avatars(client); const result = await avatars.getBrowser({ code: sdk.Browser.AvantBrowser, width: 0, // optional height: 0, // optional quality: -1 // optional }); ``` -------------------------------- ### Create Database with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/databases/create.md Use this snippet to create a new database. Ensure you have initialized the Appwrite client with your project details and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const databases = new sdk.Databases(client); const result = await databases.create({ databaseId: '', name: '', enabled: false // optional }); ``` -------------------------------- ### Create Session with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/account/create-session.md This snippet demonstrates how to initialize the Appwrite client and create a user session using the Account service. Ensure you replace placeholders like '', '', '', and '' with your actual project details and user credentials. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setSession(''); // The user session to authenticate with const account = new sdk.Account(client); const result = await account.createSession({ userId: '', secret: '' }); ``` -------------------------------- ### Get a Specific Event Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/activities/get-event.md Use this snippet to retrieve details of a single event by its ID. Ensure you have initialized the Appwrite client with your project credentials and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const activities = new sdk.Activities(client); const result = await activities.getEvent({ eventId: '' }); ``` -------------------------------- ### Get User Preferences in Node.js Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/account/get-prefs.md Retrieves the preferences for the current user session. Ensure the client is initialized with your project ID, API endpoint, and a valid session. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setSession(''); // The user session to authenticate with const account = new sdk.Account(client); const result = await account.getPrefs(); ``` -------------------------------- ### List Proxy Rules with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/proxy/list-rules.md Initializes the Appwrite client and uses the Proxy service to list rules. Ensure you replace placeholders with your actual project details. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const proxy = new sdk.Proxy(client); const result = await proxy.listRules({ queries: [], // optional total: false // optional }); ``` -------------------------------- ### Create Website Deployment Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/sites/create-deployment.md Use this snippet to create a new deployment for your website. Ensure you have the necessary API keys and project details configured. The `code` parameter accepts a file object created with `InputFile.fromPath`. ```javascript const sdk = require('node-appwrite'); const fs = require('fs'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const sites = new sdk.Sites(client); const result = await sites.createDeployment({ siteId: '', code: InputFile.fromPath('/path/to/file', 'filename'), installCommand: '', // optional buildCommand: '', // optional outputDirectory: '', // optional activate: false // optional }); ``` -------------------------------- ### Get a Token by ID Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/tokens/get.md Initializes the Appwrite client and retrieves a token using its unique ID. Ensure you replace placeholders with your actual project details and token ID. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const tokens = new sdk.Tokens(client); const result = await tokens.get({ tokenId: '' }); ``` -------------------------------- ### Create Duplicate Deployment with Node.js SDK Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/sites/create-duplicate-deployment.md Initializes the Appwrite client and demonstrates how to call the createDuplicateDeployment function. Ensure you replace placeholders with your actual project details and IDs. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const sites = new sdk.Sites(client); const result = await sites.createDuplicateDeployment({ siteId: '', deploymentId: '' }); ``` -------------------------------- ### Get Column Details in Node.js Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/tablesdb/get-column.md Retrieves the details of a specific column within a database table. Ensure you have initialized the Appwrite client with your project credentials and API key. ```javascript const sdk = require('node-appwrite'); const client = sdk.Client.fromEnv() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.getColumn({ databaseId: '', tableId: '', key: '' }); ``` -------------------------------- ### Get Proxy Rule by ID Source: https://github.com/appwrite/sdk-for-node/blob/main/docs/examples/proxy/get-rule.md Use this snippet to fetch a specific proxy rule by its ID. Ensure you have initialized the Appwrite client with your project details and API key. ```javascript const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const proxy = new sdk.Proxy(client); const result = await proxy.getRule({ ruleId: '' }); ```