├── .github
├── ISSUE_TEMPLATE
│ ├── bug.yaml
│ ├── documentation.yaml
│ └── feature.yaml
└── workflows
│ ├── autoclose.yml
│ └── publish.yml
├── CHANGELOG.md
├── LICENSE
├── README.md
├── dist
├── cjs
│ └── package.json
└── esm
│ └── package.json
├── docs
└── examples
│ ├── account
│ ├── create-anonymous-session.md
│ ├── create-email-password-session.md
│ ├── create-email-token.md
│ ├── create-j-w-t.md
│ ├── create-magic-u-r-l-token.md
│ ├── create-mfa-authenticator.md
│ ├── create-mfa-challenge.md
│ ├── create-mfa-recovery-codes.md
│ ├── create-o-auth2session.md
│ ├── create-o-auth2token.md
│ ├── create-phone-token.md
│ ├── create-phone-verification.md
│ ├── create-push-target.md
│ ├── create-recovery.md
│ ├── create-session.md
│ ├── create-verification.md
│ ├── create.md
│ ├── delete-identity.md
│ ├── delete-mfa-authenticator.md
│ ├── delete-push-target.md
│ ├── delete-session.md
│ ├── delete-sessions.md
│ ├── get-mfa-recovery-codes.md
│ ├── get-prefs.md
│ ├── get-session.md
│ ├── get.md
│ ├── list-identities.md
│ ├── list-logs.md
│ ├── list-mfa-factors.md
│ ├── list-sessions.md
│ ├── update-email.md
│ ├── update-m-f-a.md
│ ├── update-magic-u-r-l-session.md
│ ├── update-mfa-authenticator.md
│ ├── update-mfa-challenge.md
│ ├── update-mfa-recovery-codes.md
│ ├── update-name.md
│ ├── update-password.md
│ ├── update-phone-session.md
│ ├── update-phone-verification.md
│ ├── update-phone.md
│ ├── update-prefs.md
│ ├── update-push-target.md
│ ├── update-recovery.md
│ ├── update-session.md
│ ├── update-status.md
│ └── update-verification.md
│ ├── avatars
│ ├── get-browser.md
│ ├── get-credit-card.md
│ ├── get-favicon.md
│ ├── get-flag.md
│ ├── get-image.md
│ ├── get-initials.md
│ └── get-q-r.md
│ ├── databases
│ ├── create-document.md
│ ├── delete-document.md
│ ├── get-document.md
│ ├── list-documents.md
│ ├── update-document.md
│ └── upsert-document.md
│ ├── functions
│ ├── create-execution.md
│ ├── get-execution.md
│ └── list-executions.md
│ ├── graphql
│ ├── mutation.md
│ └── query.md
│ ├── locale
│ ├── get.md
│ ├── list-codes.md
│ ├── list-continents.md
│ ├── list-countries-e-u.md
│ ├── list-countries-phones.md
│ ├── list-countries.md
│ ├── list-currencies.md
│ └── list-languages.md
│ ├── messaging
│ ├── create-subscriber.md
│ └── delete-subscriber.md
│ ├── storage
│ ├── create-file.md
│ ├── delete-file.md
│ ├── get-file-download.md
│ ├── get-file-preview.md
│ ├── get-file-view.md
│ ├── get-file.md
│ ├── list-files.md
│ └── update-file.md
│ └── teams
│ ├── create-membership.md
│ ├── create.md
│ ├── delete-membership.md
│ ├── delete.md
│ ├── get-membership.md
│ ├── get-prefs.md
│ ├── get.md
│ ├── list-memberships.md
│ ├── list.md
│ ├── update-membership-status.md
│ ├── update-membership.md
│ ├── update-name.md
│ └── update-prefs.md
├── package.json
├── rollup.config.js
├── src
├── client.ts
├── enums
│ ├── authentication-factor.ts
│ ├── authenticator-type.ts
│ ├── browser.ts
│ ├── credit-card.ts
│ ├── execution-method.ts
│ ├── flag.ts
│ ├── image-format.ts
│ ├── image-gravity.ts
│ └── o-auth-provider.ts
├── id.ts
├── index.ts
├── models.ts
├── permission.ts
├── query.ts
├── role.ts
├── service.ts
└── services
│ ├── account.ts
│ ├── avatars.ts
│ ├── databases.ts
│ ├── functions.ts
│ ├── graphql.ts
│ ├── locale.ts
│ ├── messaging.ts
│ ├── storage.ts
│ └── teams.ts
└── tsconfig.json
/.github/ISSUE_TEMPLATE/bug.yaml:
--------------------------------------------------------------------------------
1 | name: "🐛 Bug Report"
2 | description: "Submit a bug report to help us improve"
3 | title: "🐛 Bug Report: "
4 | labels: [bug]
5 | body:
6 | - type: markdown
7 | attributes:
8 | value: |
9 | Thanks for taking the time to fill out our bug report form 🙏
10 | - type: textarea
11 | id: steps-to-reproduce
12 | validations:
13 | required: true
14 | attributes:
15 | label: "👟 Reproduction steps"
16 | description: "How do you trigger this bug? Please walk us through it step by step."
17 | placeholder: "When I ..."
18 | - type: textarea
19 | id: expected-behavior
20 | validations:
21 | required: true
22 | attributes:
23 | label: "👍 Expected behavior"
24 | description: "What did you think would happen?"
25 | placeholder: "It should ..."
26 | - type: textarea
27 | id: actual-behavior
28 | validations:
29 | required: true
30 | attributes:
31 | label: "👎 Actual Behavior"
32 | description: "What did actually happen? Add screenshots, if applicable."
33 | placeholder: "It actually ..."
34 | - type: dropdown
35 | id: appwrite-version
36 | attributes:
37 | label: "🎲 Appwrite version"
38 | description: "What version of Appwrite are you running?"
39 | options:
40 | - Version 0.10.x
41 | - Version 0.9.x
42 | - Version 0.8.x
43 | - Version 0.7.x
44 | - Version 0.6.x
45 | - Different version (specify in environment)
46 | validations:
47 | required: true
48 | - type: dropdown
49 | id: operating-system
50 | attributes:
51 | label: "💻 Operating system"
52 | description: "What OS is your server / device running on?"
53 | options:
54 | - Linux
55 | - MacOS
56 | - Windows
57 | - Something else
58 | validations:
59 | required: true
60 | - type: textarea
61 | id: enviromnemt
62 | validations:
63 | required: false
64 | attributes:
65 | label: "🧱 Your Environment"
66 | description: "Is your environment customized in any way?"
67 | placeholder: "I use Cloudflare for ..."
68 | - type: checkboxes
69 | id: no-duplicate-issues
70 | attributes:
71 | label: "👀 Have you spent some time to check if this issue has been raised before?"
72 | description: "Have you Googled for a similar issue or checked our older issues for a similar bug?"
73 | options:
74 | - label: "I checked and didn't find similar issue"
75 | required: true
76 | - type: checkboxes
77 | id: read-code-of-conduct
78 | attributes:
79 | label: "🏢 Have you read the Code of Conduct?"
80 | options:
81 | - label: "I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)"
82 | required: true
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/documentation.yaml:
--------------------------------------------------------------------------------
1 | name: "📚 Documentation"
2 | description: "Report an issue related to documentation"
3 | title: "📚 Documentation: "
4 | labels: [documentation]
5 | body:
6 | - type: markdown
7 | attributes:
8 | value: |
9 | Thanks for taking the time to make our documentation better 🙏
10 | - type: textarea
11 | id: issue-description
12 | validations:
13 | required: true
14 | attributes:
15 | label: "💭 Description"
16 | description: "A clear and concise description of what the issue is."
17 | placeholder: "Documentation should not ..."
18 | - type: checkboxes
19 | id: no-duplicate-issues
20 | attributes:
21 | label: "👀 Have you spent some time to check if this issue has been raised before?"
22 | description: "Have you Googled for a similar issue or checked our older issues for a similar bug?"
23 | options:
24 | - label: "I checked and didn't find similar issue"
25 | required: true
26 | - type: checkboxes
27 | id: read-code-of-conduct
28 | attributes:
29 | label: "🏢 Have you read the Code of Conduct?"
30 | options:
31 | - label: "I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)"
32 | required: true
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature.yaml:
--------------------------------------------------------------------------------
1 | name: 🚀 Feature
2 | description: "Submit a proposal for a new feature"
3 | title: "🚀 Feature: "
4 | labels: [feature]
5 | body:
6 | - type: markdown
7 | attributes:
8 | value: |
9 | Thanks for taking the time to fill out our feature request form 🙏
10 | - type: textarea
11 | id: feature-description
12 | validations:
13 | required: true
14 | attributes:
15 | label: "🔖 Feature description"
16 | description: "A clear and concise description of what the feature is."
17 | placeholder: "You should add ..."
18 | - type: textarea
19 | id: pitch
20 | validations:
21 | required: true
22 | attributes:
23 | label: "🎤 Pitch"
24 | description: "Please explain why this feature should be implemented and how it would be used. Add examples, if applicable."
25 | placeholder: "In my use-case, ..."
26 | - type: checkboxes
27 | id: no-duplicate-issues
28 | attributes:
29 | label: "👀 Have you spent some time to check if this issue has been raised before?"
30 | description: "Have you Googled for a similar issue or checked our older issues for a similar bug?"
31 | options:
32 | - label: "I checked and didn't find similar issue"
33 | required: true
34 | - type: checkboxes
35 | id: read-code-of-conduct
36 | attributes:
37 | label: "🏢 Have you read the Code of Conduct?"
38 | options:
39 | - label: "I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)"
40 | required: true
--------------------------------------------------------------------------------
/.github/workflows/autoclose.yml:
--------------------------------------------------------------------------------
1 | name: Auto-close External Pull Requests
2 |
3 | on:
4 | pull_request_target:
5 | types: [opened, reopened]
6 |
7 | jobs:
8 | auto_close:
9 | uses: appwrite/.github/.github/workflows/autoclose.yml@main
10 | secrets:
11 | GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }}
12 |
--------------------------------------------------------------------------------
/.github/workflows/publish.yml:
--------------------------------------------------------------------------------
1 | name: Publish to NPM
2 |
3 | on:
4 | release:
5 | types: [published]
6 | workflow_dispatch:
7 |
8 | jobs:
9 | publish:
10 | runs-on: ubuntu-latest
11 |
12 | steps:
13 | - uses: actions/checkout@v4
14 |
15 | # Setup Node.js environment
16 | - name: Use Node.js
17 | uses: actions/setup-node@v4
18 | with:
19 | node-version: '20.x'
20 | registry-url: 'https://registry.npmjs.org'
21 |
22 | # Determine release tag based on the tag name
23 | - name: Determine release tag
24 | id: release_tag
25 | run: |
26 | if [[ "${{ github.ref }}" == *"-rc"* ]] || [[ "${{ github.ref }}" == *"-RC"* ]]; then
27 | echo "tag=next" >> "$GITHUB_OUTPUT"
28 | else
29 | echo "tag=latest" >> "$GITHUB_OUTPUT"
30 | fi
31 |
32 | # Install dependencies (if any) and build your project (if necessary)
33 | - name: Install dependencies and build
34 | run: |
35 | npm install
36 | npm run build
37 |
38 | # Publish to NPM with the appropriate tag
39 | - name: Publish
40 | run: npm publish --tag ${{ steps.release_tag.outputs.tag }}
41 | env:
42 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
43 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 |
3 | ## 18.0.0
4 |
5 | * Add `<REGION>` to doc examples due to the new multi region endpoints
6 | * Remove `Gif` from ImageFormat enum
7 | * Remove `search` param from `listExecutions` method
8 | * Add `token` param to `getFilePreview` and `getFileView` for File tokens usage
9 | * Improve CORS error catching in `client.call` method
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors.
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5 |
6 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7 |
8 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 |
10 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11 |
12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Appwrite Web SDK
2 |
3 | 
4 | 
5 | [](https://travis-ci.com/appwrite/sdk-generator)
6 | [](https://twitter.com/appwrite)
7 | [](https://appwrite.io/discord)
8 |
9 | **This SDK is compatible with Appwrite server version 1.7.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-web/releases).**
10 |
11 | Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Web SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
12 |
13 | 
14 |
15 | ## Installation
16 |
17 | ### NPM
18 |
19 | To install via [NPM](https://www.npmjs.com/):
20 |
21 | ```bash
22 | npm install appwrite --save
23 | ```
24 |
25 | If you're using a bundler (like [Rollup](https://rollupjs.org/) or [webpack](https://webpack.js.org/)), you can import the Appwrite module when you need it:
26 |
27 | ```js
28 | import { Client, Account } from "appwrite";
29 | ```
30 |
31 | ### CDN
32 |
33 | To install with a CDN (content delivery network) add the following scripts to the bottom of your
tag, but before you use any Appwrite services:
34 |
35 | ```html
36 |
37 | ```
38 |
39 |
40 | ## Getting Started
41 |
42 | ### Add your Web Platform
43 | For you to init your SDK and interact with Appwrite services you need to add a web platform to your project. To add a new platform, go to your Appwrite console, choose the project you created in the step before and click the 'Add Platform' button.
44 |
45 | From the options, choose to add a **Web** platform and add your client app hostname. By adding your hostname to your project platform you are allowing cross-domain communication between your project and the Appwrite API.
46 |
47 | ### Init your SDK
48 | Initialize your SDK with your Appwrite server API endpoint and project ID which can be found in your project settings page.
49 |
50 | ```js
51 | // Init your Web SDK
52 | const client = new Client();
53 |
54 | client
55 | .setEndpoint('http://localhost/v1') // Your Appwrite Endpoint
56 | .setProject('455x34dfkj') // Your project ID
57 | ;
58 | ```
59 |
60 | ### Make Your First Request
61 | Once your SDK object is set, access any of the Appwrite services and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the [API References](https://appwrite.io/docs) section.
62 |
63 | ```js
64 | const account = new Account(client);
65 |
66 | // Register User
67 | account.create(ID.unique(), "email@example.com", "password", "Walter O'Brien")
68 | .then(function (response) {
69 | console.log(response);
70 | }, function (error) {
71 | console.log(error);
72 | });
73 |
74 | ```
75 |
76 | ### Full Example
77 | ```js
78 | // Init your Web SDK
79 | const client = new Client();
80 |
81 | client
82 | .setEndpoint('http://localhost/v1') // Your Appwrite Endpoint
83 | .setProject('455x34dfkj')
84 | ;
85 |
86 | const account = new Account(client);
87 |
88 | // Register User
89 | account.create(ID.unique(), "email@example.com", "password", "Walter O'Brien")
90 | .then(function (response) {
91 | console.log(response);
92 | }, function (error) {
93 | console.log(error);
94 | });
95 | ```
96 |
97 | ### Learn more
98 | You can use the following resources to learn more and get help
99 | - 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-web)
100 | - 📜 [Appwrite Docs](https://appwrite.io/docs)
101 | - 💬 [Discord Community](https://appwrite.io/discord)
102 | - 🚂 [Appwrite Web Playground](https://github.com/appwrite/playground-for-web)
103 |
104 |
105 | ## Contribution
106 |
107 | This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request.
108 |
109 | ## License
110 |
111 | Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information.
--------------------------------------------------------------------------------
/dist/cjs/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "commonjs"
3 | }
--------------------------------------------------------------------------------
/dist/esm/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "module"
3 | }
--------------------------------------------------------------------------------
/docs/examples/account/create-anonymous-session.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.createAnonymousSession();
10 |
11 | console.log(result);
12 |
--------------------------------------------------------------------------------
/docs/examples/account/create-email-password-session.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.createEmailPasswordSession(
10 | 'email@example.com', // email
11 | 'password' // password
12 | );
13 |
14 | console.log(result);
15 |
--------------------------------------------------------------------------------
/docs/examples/account/create-email-token.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.createEmailToken(
10 | '', // userId
11 | 'email@example.com', // email
12 | false // phrase (optional)
13 | );
14 |
15 | console.log(result);
16 |
--------------------------------------------------------------------------------
/docs/examples/account/create-j-w-t.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.createJWT();
10 |
11 | console.log(result);
12 |
--------------------------------------------------------------------------------
/docs/examples/account/create-magic-u-r-l-token.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.createMagicURLToken(
10 | '', // userId
11 | 'email@example.com', // email
12 | 'https://example.com', // url (optional)
13 | false // phrase (optional)
14 | );
15 |
16 | console.log(result);
17 |
--------------------------------------------------------------------------------
/docs/examples/account/create-mfa-authenticator.md:
--------------------------------------------------------------------------------
1 | import { Client, Account, AuthenticatorType } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.createMfaAuthenticator(
10 | AuthenticatorType.Totp // type
11 | );
12 |
13 | console.log(result);
14 |
--------------------------------------------------------------------------------
/docs/examples/account/create-mfa-challenge.md:
--------------------------------------------------------------------------------
1 | import { Client, Account, AuthenticationFactor } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.createMfaChallenge(
10 | AuthenticationFactor.Email // factor
11 | );
12 |
13 | console.log(result);
14 |
--------------------------------------------------------------------------------
/docs/examples/account/create-mfa-recovery-codes.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.createMfaRecoveryCodes();
10 |
11 | console.log(result);
12 |
--------------------------------------------------------------------------------
/docs/examples/account/create-o-auth2session.md:
--------------------------------------------------------------------------------
1 | import { Client, Account, OAuthProvider } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | account.createOAuth2Session(
10 | OAuthProvider.Amazon, // provider
11 | 'https://example.com', // success (optional)
12 | 'https://example.com', // failure (optional)
13 | [] // scopes (optional)
14 | );
15 |
16 |
--------------------------------------------------------------------------------
/docs/examples/account/create-o-auth2token.md:
--------------------------------------------------------------------------------
1 | import { Client, Account, OAuthProvider } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | account.createOAuth2Token(
10 | OAuthProvider.Amazon, // provider
11 | 'https://example.com', // success (optional)
12 | 'https://example.com', // failure (optional)
13 | [] // scopes (optional)
14 | );
15 |
16 |
--------------------------------------------------------------------------------
/docs/examples/account/create-phone-token.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.createPhoneToken(
10 | '', // userId
11 | '+12065550100' // phone
12 | );
13 |
14 | console.log(result);
15 |
--------------------------------------------------------------------------------
/docs/examples/account/create-phone-verification.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.createPhoneVerification();
10 |
11 | console.log(result);
12 |
--------------------------------------------------------------------------------
/docs/examples/account/create-push-target.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.createPushTarget(
10 | '', // targetId
11 | '', // identifier
12 | '' // providerId (optional)
13 | );
14 |
15 | console.log(result);
16 |
--------------------------------------------------------------------------------
/docs/examples/account/create-recovery.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.createRecovery(
10 | 'email@example.com', // email
11 | 'https://example.com' // url
12 | );
13 |
14 | console.log(result);
15 |
--------------------------------------------------------------------------------
/docs/examples/account/create-session.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.createSession(
10 | '', // userId
11 | '' // secret
12 | );
13 |
14 | console.log(result);
15 |
--------------------------------------------------------------------------------
/docs/examples/account/create-verification.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.createVerification(
10 | 'https://example.com' // url
11 | );
12 |
13 | console.log(result);
14 |
--------------------------------------------------------------------------------
/docs/examples/account/create.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.create(
10 | '', // userId
11 | 'email@example.com', // email
12 | '', // password
13 | '' // name (optional)
14 | );
15 |
16 | console.log(result);
17 |
--------------------------------------------------------------------------------
/docs/examples/account/delete-identity.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.deleteIdentity(
10 | '' // identityId
11 | );
12 |
13 | console.log(result);
14 |
--------------------------------------------------------------------------------
/docs/examples/account/delete-mfa-authenticator.md:
--------------------------------------------------------------------------------
1 | import { Client, Account, AuthenticatorType } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.deleteMfaAuthenticator(
10 | AuthenticatorType.Totp // type
11 | );
12 |
13 | console.log(result);
14 |
--------------------------------------------------------------------------------
/docs/examples/account/delete-push-target.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.deletePushTarget(
10 | '' // targetId
11 | );
12 |
13 | console.log(result);
14 |
--------------------------------------------------------------------------------
/docs/examples/account/delete-session.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.deleteSession(
10 | '' // sessionId
11 | );
12 |
13 | console.log(result);
14 |
--------------------------------------------------------------------------------
/docs/examples/account/delete-sessions.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.deleteSessions();
10 |
11 | console.log(result);
12 |
--------------------------------------------------------------------------------
/docs/examples/account/get-mfa-recovery-codes.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.getMfaRecoveryCodes();
10 |
11 | console.log(result);
12 |
--------------------------------------------------------------------------------
/docs/examples/account/get-prefs.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.getPrefs();
10 |
11 | console.log(result);
12 |
--------------------------------------------------------------------------------
/docs/examples/account/get-session.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.getSession(
10 | '' // sessionId
11 | );
12 |
13 | console.log(result);
14 |
--------------------------------------------------------------------------------
/docs/examples/account/get.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.get();
10 |
11 | console.log(result);
12 |
--------------------------------------------------------------------------------
/docs/examples/account/list-identities.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.listIdentities(
10 | [] // queries (optional)
11 | );
12 |
13 | console.log(result);
14 |
--------------------------------------------------------------------------------
/docs/examples/account/list-logs.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.listLogs(
10 | [] // queries (optional)
11 | );
12 |
13 | console.log(result);
14 |
--------------------------------------------------------------------------------
/docs/examples/account/list-mfa-factors.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.listMfaFactors();
10 |
11 | console.log(result);
12 |
--------------------------------------------------------------------------------
/docs/examples/account/list-sessions.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.listSessions();
10 |
11 | console.log(result);
12 |
--------------------------------------------------------------------------------
/docs/examples/account/update-email.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.updateEmail(
10 | 'email@example.com', // email
11 | 'password' // password
12 | );
13 |
14 | console.log(result);
15 |
--------------------------------------------------------------------------------
/docs/examples/account/update-m-f-a.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.updateMFA(
10 | false // mfa
11 | );
12 |
13 | console.log(result);
14 |
--------------------------------------------------------------------------------
/docs/examples/account/update-magic-u-r-l-session.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.updateMagicURLSession(
10 | '', // userId
11 | '' // secret
12 | );
13 |
14 | console.log(result);
15 |
--------------------------------------------------------------------------------
/docs/examples/account/update-mfa-authenticator.md:
--------------------------------------------------------------------------------
1 | import { Client, Account, AuthenticatorType } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.updateMfaAuthenticator(
10 | AuthenticatorType.Totp, // type
11 | '' // otp
12 | );
13 |
14 | console.log(result);
15 |
--------------------------------------------------------------------------------
/docs/examples/account/update-mfa-challenge.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.updateMfaChallenge(
10 | '', // challengeId
11 | '' // otp
12 | );
13 |
14 | console.log(result);
15 |
--------------------------------------------------------------------------------
/docs/examples/account/update-mfa-recovery-codes.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.updateMfaRecoveryCodes();
10 |
11 | console.log(result);
12 |
--------------------------------------------------------------------------------
/docs/examples/account/update-name.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.updateName(
10 | '' // name
11 | );
12 |
13 | console.log(result);
14 |
--------------------------------------------------------------------------------
/docs/examples/account/update-password.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.updatePassword(
10 | '', // password
11 | 'password' // oldPassword (optional)
12 | );
13 |
14 | console.log(result);
15 |
--------------------------------------------------------------------------------
/docs/examples/account/update-phone-session.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.updatePhoneSession(
10 | '', // userId
11 | '' // secret
12 | );
13 |
14 | console.log(result);
15 |
--------------------------------------------------------------------------------
/docs/examples/account/update-phone-verification.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.updatePhoneVerification(
10 | '', // userId
11 | '' // secret
12 | );
13 |
14 | console.log(result);
15 |
--------------------------------------------------------------------------------
/docs/examples/account/update-phone.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.updatePhone(
10 | '+12065550100', // phone
11 | 'password' // password
12 | );
13 |
14 | console.log(result);
15 |
--------------------------------------------------------------------------------
/docs/examples/account/update-prefs.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.updatePrefs(
10 | {} // prefs
11 | );
12 |
13 | console.log(result);
14 |
--------------------------------------------------------------------------------
/docs/examples/account/update-push-target.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.updatePushTarget(
10 | '', // targetId
11 | '' // identifier
12 | );
13 |
14 | console.log(result);
15 |
--------------------------------------------------------------------------------
/docs/examples/account/update-recovery.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.updateRecovery(
10 | '', // userId
11 | '', // secret
12 | '' // password
13 | );
14 |
15 | console.log(result);
16 |
--------------------------------------------------------------------------------
/docs/examples/account/update-session.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.updateSession(
10 | '' // sessionId
11 | );
12 |
13 | console.log(result);
14 |
--------------------------------------------------------------------------------
/docs/examples/account/update-status.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.updateStatus();
10 |
11 | console.log(result);
12 |
--------------------------------------------------------------------------------
/docs/examples/account/update-verification.md:
--------------------------------------------------------------------------------
1 | import { Client, Account } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const account = new Account(client);
8 |
9 | const result = await account.updateVerification(
10 | '', // userId
11 | '' // secret
12 | );
13 |
14 | console.log(result);
15 |
--------------------------------------------------------------------------------
/docs/examples/avatars/get-browser.md:
--------------------------------------------------------------------------------
1 | import { Client, Avatars, Browser } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const avatars = new Avatars(client);
8 |
9 | const result = avatars.getBrowser(
10 | Browser.AvantBrowser, // code
11 | 0, // width (optional)
12 | 0, // height (optional)
13 | -1 // quality (optional)
14 | );
15 |
16 | console.log(result);
17 |
--------------------------------------------------------------------------------
/docs/examples/avatars/get-credit-card.md:
--------------------------------------------------------------------------------
1 | import { Client, Avatars, CreditCard } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const avatars = new Avatars(client);
8 |
9 | const result = avatars.getCreditCard(
10 | CreditCard.AmericanExpress, // code
11 | 0, // width (optional)
12 | 0, // height (optional)
13 | -1 // quality (optional)
14 | );
15 |
16 | console.log(result);
17 |
--------------------------------------------------------------------------------
/docs/examples/avatars/get-favicon.md:
--------------------------------------------------------------------------------
1 | import { Client, Avatars } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const avatars = new Avatars(client);
8 |
9 | const result = avatars.getFavicon(
10 | 'https://example.com' // url
11 | );
12 |
13 | console.log(result);
14 |
--------------------------------------------------------------------------------
/docs/examples/avatars/get-flag.md:
--------------------------------------------------------------------------------
1 | import { Client, Avatars, Flag } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const avatars = new Avatars(client);
8 |
9 | const result = avatars.getFlag(
10 | Flag.Afghanistan, // code
11 | 0, // width (optional)
12 | 0, // height (optional)
13 | -1 // quality (optional)
14 | );
15 |
16 | console.log(result);
17 |
--------------------------------------------------------------------------------
/docs/examples/avatars/get-image.md:
--------------------------------------------------------------------------------
1 | import { Client, Avatars } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const avatars = new Avatars(client);
8 |
9 | const result = avatars.getImage(
10 | 'https://example.com', // url
11 | 0, // width (optional)
12 | 0 // height (optional)
13 | );
14 |
15 | console.log(result);
16 |
--------------------------------------------------------------------------------
/docs/examples/avatars/get-initials.md:
--------------------------------------------------------------------------------
1 | import { Client, Avatars } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const avatars = new Avatars(client);
8 |
9 | const result = avatars.getInitials(
10 | '', // name (optional)
11 | 0, // width (optional)
12 | 0, // height (optional)
13 | '' // background (optional)
14 | );
15 |
16 | console.log(result);
17 |
--------------------------------------------------------------------------------
/docs/examples/avatars/get-q-r.md:
--------------------------------------------------------------------------------
1 | import { Client, Avatars } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const avatars = new Avatars(client);
8 |
9 | const result = avatars.getQR(
10 | '', // text
11 | 1, // size (optional)
12 | 0, // margin (optional)
13 | false // download (optional)
14 | );
15 |
16 | console.log(result);
17 |
--------------------------------------------------------------------------------
/docs/examples/databases/create-document.md:
--------------------------------------------------------------------------------
1 | import { Client, Databases } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setSession('') // The user session to authenticate with
6 | .setKey('') //
7 | .setJWT(''); // Your secret JSON Web Token
8 |
9 | const databases = new Databases(client);
10 |
11 | const result = await databases.createDocument(
12 | '', // databaseId
13 | '', // collectionId
14 | '', // documentId
15 | {}, // data
16 | ["read("any")"] // permissions (optional)
17 | );
18 |
19 | console.log(result);
20 |
--------------------------------------------------------------------------------
/docs/examples/databases/delete-document.md:
--------------------------------------------------------------------------------
1 | import { Client, Databases } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const databases = new Databases(client);
8 |
9 | const result = await databases.deleteDocument(
10 | '', // databaseId
11 | '', // collectionId
12 | '' // documentId
13 | );
14 |
15 | console.log(result);
16 |
--------------------------------------------------------------------------------
/docs/examples/databases/get-document.md:
--------------------------------------------------------------------------------
1 | import { Client, Databases } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const databases = new Databases(client);
8 |
9 | const result = await databases.getDocument(
10 | '', // databaseId
11 | '', // collectionId
12 | '', // documentId
13 | [] // queries (optional)
14 | );
15 |
16 | console.log(result);
17 |
--------------------------------------------------------------------------------
/docs/examples/databases/list-documents.md:
--------------------------------------------------------------------------------
1 | import { Client, Databases } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const databases = new Databases(client);
8 |
9 | const result = await databases.listDocuments(
10 | '', // databaseId
11 | '', // collectionId
12 | [] // queries (optional)
13 | );
14 |
15 | console.log(result);
16 |
--------------------------------------------------------------------------------
/docs/examples/databases/update-document.md:
--------------------------------------------------------------------------------
1 | import { Client, Databases } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const databases = new Databases(client);
8 |
9 | const result = await databases.updateDocument(
10 | '', // databaseId
11 | '', // collectionId
12 | '', // documentId
13 | {}, // data (optional)
14 | ["read("any")"] // permissions (optional)
15 | );
16 |
17 | console.log(result);
18 |
--------------------------------------------------------------------------------
/docs/examples/databases/upsert-document.md:
--------------------------------------------------------------------------------
1 | import { Client, Databases } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const databases = new Databases(client);
8 |
9 | const result = await databases.upsertDocument(
10 | '', // databaseId
11 | '', // collectionId
12 | '', // documentId
13 | {}, // data
14 | ["read("any")"] // permissions (optional)
15 | );
16 |
17 | console.log(result);
18 |
--------------------------------------------------------------------------------
/docs/examples/functions/create-execution.md:
--------------------------------------------------------------------------------
1 | import { Client, Functions, ExecutionMethod } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const functions = new Functions(client);
8 |
9 | const result = await functions.createExecution(
10 | '', // functionId
11 | '', // body (optional)
12 | false, // async (optional)
13 | '', // path (optional)
14 | ExecutionMethod.GET, // method (optional)
15 | {}, // headers (optional)
16 | '' // scheduledAt (optional)
17 | );
18 |
19 | console.log(result);
20 |
--------------------------------------------------------------------------------
/docs/examples/functions/get-execution.md:
--------------------------------------------------------------------------------
1 | import { Client, Functions } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const functions = new Functions(client);
8 |
9 | const result = await functions.getExecution(
10 | '', // functionId
11 | '' // executionId
12 | );
13 |
14 | console.log(result);
15 |
--------------------------------------------------------------------------------
/docs/examples/functions/list-executions.md:
--------------------------------------------------------------------------------
1 | import { Client, Functions } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const functions = new Functions(client);
8 |
9 | const result = await functions.listExecutions(
10 | '', // functionId
11 | [] // queries (optional)
12 | );
13 |
14 | console.log(result);
15 |
--------------------------------------------------------------------------------
/docs/examples/graphql/mutation.md:
--------------------------------------------------------------------------------
1 | import { Client, Graphql } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const graphql = new Graphql(client);
8 |
9 | const result = await graphql.mutation(
10 | {} // query
11 | );
12 |
13 | console.log(result);
14 |
--------------------------------------------------------------------------------
/docs/examples/graphql/query.md:
--------------------------------------------------------------------------------
1 | import { Client, Graphql } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const graphql = new Graphql(client);
8 |
9 | const result = await graphql.query(
10 | {} // query
11 | );
12 |
13 | console.log(result);
14 |
--------------------------------------------------------------------------------
/docs/examples/locale/get.md:
--------------------------------------------------------------------------------
1 | import { Client, Locale } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const locale = new Locale(client);
8 |
9 | const result = await locale.get();
10 |
11 | console.log(result);
12 |
--------------------------------------------------------------------------------
/docs/examples/locale/list-codes.md:
--------------------------------------------------------------------------------
1 | import { Client, Locale } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const locale = new Locale(client);
8 |
9 | const result = await locale.listCodes();
10 |
11 | console.log(result);
12 |
--------------------------------------------------------------------------------
/docs/examples/locale/list-continents.md:
--------------------------------------------------------------------------------
1 | import { Client, Locale } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const locale = new Locale(client);
8 |
9 | const result = await locale.listContinents();
10 |
11 | console.log(result);
12 |
--------------------------------------------------------------------------------
/docs/examples/locale/list-countries-e-u.md:
--------------------------------------------------------------------------------
1 | import { Client, Locale } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const locale = new Locale(client);
8 |
9 | const result = await locale.listCountriesEU();
10 |
11 | console.log(result);
12 |
--------------------------------------------------------------------------------
/docs/examples/locale/list-countries-phones.md:
--------------------------------------------------------------------------------
1 | import { Client, Locale } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const locale = new Locale(client);
8 |
9 | const result = await locale.listCountriesPhones();
10 |
11 | console.log(result);
12 |
--------------------------------------------------------------------------------
/docs/examples/locale/list-countries.md:
--------------------------------------------------------------------------------
1 | import { Client, Locale } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const locale = new Locale(client);
8 |
9 | const result = await locale.listCountries();
10 |
11 | console.log(result);
12 |
--------------------------------------------------------------------------------
/docs/examples/locale/list-currencies.md:
--------------------------------------------------------------------------------
1 | import { Client, Locale } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const locale = new Locale(client);
8 |
9 | const result = await locale.listCurrencies();
10 |
11 | console.log(result);
12 |
--------------------------------------------------------------------------------
/docs/examples/locale/list-languages.md:
--------------------------------------------------------------------------------
1 | import { Client, Locale } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const locale = new Locale(client);
8 |
9 | const result = await locale.listLanguages();
10 |
11 | console.log(result);
12 |
--------------------------------------------------------------------------------
/docs/examples/messaging/create-subscriber.md:
--------------------------------------------------------------------------------
1 | import { Client, Messaging } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const messaging = new Messaging(client);
8 |
9 | const result = await messaging.createSubscriber(
10 | '', // topicId
11 | '', // subscriberId
12 | '' // targetId
13 | );
14 |
15 | console.log(result);
16 |
--------------------------------------------------------------------------------
/docs/examples/messaging/delete-subscriber.md:
--------------------------------------------------------------------------------
1 | import { Client, Messaging } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const messaging = new Messaging(client);
8 |
9 | const result = await messaging.deleteSubscriber(
10 | '', // topicId
11 | '' // subscriberId
12 | );
13 |
14 | console.log(result);
15 |
--------------------------------------------------------------------------------
/docs/examples/storage/create-file.md:
--------------------------------------------------------------------------------
1 | import { Client, Storage } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const storage = new Storage(client);
8 |
9 | const result = await storage.createFile(
10 | '', // bucketId
11 | '', // fileId
12 | document.getElementById('uploader').files[0], // file
13 | ["read("any")"] // permissions (optional)
14 | );
15 |
16 | console.log(result);
17 |
--------------------------------------------------------------------------------
/docs/examples/storage/delete-file.md:
--------------------------------------------------------------------------------
1 | import { Client, Storage } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const storage = new Storage(client);
8 |
9 | const result = await storage.deleteFile(
10 | '', // bucketId
11 | '' // fileId
12 | );
13 |
14 | console.log(result);
15 |
--------------------------------------------------------------------------------
/docs/examples/storage/get-file-download.md:
--------------------------------------------------------------------------------
1 | import { Client, Storage } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const storage = new Storage(client);
8 |
9 | const result = storage.getFileDownload(
10 | '', // bucketId
11 | '', // fileId
12 | '' // token (optional)
13 | );
14 |
15 | console.log(result);
16 |
--------------------------------------------------------------------------------
/docs/examples/storage/get-file-preview.md:
--------------------------------------------------------------------------------
1 | import { Client, Storage, ImageGravity, ImageFormat } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const storage = new Storage(client);
8 |
9 | const result = storage.getFilePreview(
10 | '', // bucketId
11 | '', // fileId
12 | 0, // width (optional)
13 | 0, // height (optional)
14 | ImageGravity.Center, // gravity (optional)
15 | -1, // quality (optional)
16 | 0, // borderWidth (optional)
17 | '', // borderColor (optional)
18 | 0, // borderRadius (optional)
19 | 0, // opacity (optional)
20 | -360, // rotation (optional)
21 | '', // background (optional)
22 | ImageFormat.Jpg, // output (optional)
23 | '' // token (optional)
24 | );
25 |
26 | console.log(result);
27 |
--------------------------------------------------------------------------------
/docs/examples/storage/get-file-view.md:
--------------------------------------------------------------------------------
1 | import { Client, Storage } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const storage = new Storage(client);
8 |
9 | const result = storage.getFileView(
10 | '', // bucketId
11 | '', // fileId
12 | '' // token (optional)
13 | );
14 |
15 | console.log(result);
16 |
--------------------------------------------------------------------------------
/docs/examples/storage/get-file.md:
--------------------------------------------------------------------------------
1 | import { Client, Storage } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const storage = new Storage(client);
8 |
9 | const result = await storage.getFile(
10 | '', // bucketId
11 | '' // fileId
12 | );
13 |
14 | console.log(result);
15 |
--------------------------------------------------------------------------------
/docs/examples/storage/list-files.md:
--------------------------------------------------------------------------------
1 | import { Client, Storage } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const storage = new Storage(client);
8 |
9 | const result = await storage.listFiles(
10 | '', // bucketId
11 | [], // queries (optional)
12 | '' // search (optional)
13 | );
14 |
15 | console.log(result);
16 |
--------------------------------------------------------------------------------
/docs/examples/storage/update-file.md:
--------------------------------------------------------------------------------
1 | import { Client, Storage } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const storage = new Storage(client);
8 |
9 | const result = await storage.updateFile(
10 | '', // bucketId
11 | '', // fileId
12 | '', // name (optional)
13 | ["read("any")"] // permissions (optional)
14 | );
15 |
16 | console.log(result);
17 |
--------------------------------------------------------------------------------
/docs/examples/teams/create-membership.md:
--------------------------------------------------------------------------------
1 | import { Client, Teams } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const teams = new Teams(client);
8 |
9 | const result = await teams.createMembership(
10 | '', // teamId
11 | [], // roles
12 | 'email@example.com', // email (optional)
13 | '', // userId (optional)
14 | '+12065550100', // phone (optional)
15 | 'https://example.com', // url (optional)
16 | '' // name (optional)
17 | );
18 |
19 | console.log(result);
20 |
--------------------------------------------------------------------------------
/docs/examples/teams/create.md:
--------------------------------------------------------------------------------
1 | import { Client, Teams } from "appwrite";
2 |
3 | const client = new Client()
4 | .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
5 | .setProject(''); // Your project ID
6 |
7 | const teams = new Teams(client);
8 |
9 | const result = await teams.create(
10 | '