├── .github └── workflows │ ├── autoclose.yml │ └── npm-publish.yml ├── .gitignore ├── Formula └── appwrite.rb ├── LICENSE.md ├── README.md ├── 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 │ ├── delete.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 │ ├── assistant │ └── chat.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 │ ├── console │ ├── get-resource.md │ └── variables.md │ ├── databases │ ├── create-boolean-attribute.md │ ├── create-collection.md │ ├── create-datetime-attribute.md │ ├── create-document.md │ ├── create-documents.md │ ├── create-email-attribute.md │ ├── create-enum-attribute.md │ ├── create-float-attribute.md │ ├── create-index.md │ ├── create-integer-attribute.md │ ├── create-ip-attribute.md │ ├── create-relationship-attribute.md │ ├── create-string-attribute.md │ ├── create-url-attribute.md │ ├── create.md │ ├── delete-attribute.md │ ├── delete-collection.md │ ├── delete-document.md │ ├── delete-documents.md │ ├── delete-index.md │ ├── delete.md │ ├── get-attribute.md │ ├── get-collection-usage.md │ ├── get-collection.md │ ├── get-database-usage.md │ ├── get-document.md │ ├── get-index.md │ ├── get-usage.md │ ├── get.md │ ├── list-attributes.md │ ├── list-collection-logs.md │ ├── list-collections.md │ ├── list-document-logs.md │ ├── list-documents.md │ ├── list-indexes.md │ ├── list-logs.md │ ├── list.md │ ├── update-boolean-attribute.md │ ├── update-collection.md │ ├── update-datetime-attribute.md │ ├── update-document.md │ ├── update-documents.md │ ├── update-email-attribute.md │ ├── update-enum-attribute.md │ ├── update-float-attribute.md │ ├── update-integer-attribute.md │ ├── update-ip-attribute.md │ ├── update-relationship-attribute.md │ ├── update-string-attribute.md │ ├── update-url-attribute.md │ ├── update.md │ ├── upsert-document.md │ └── upsert-documents.md │ ├── functions │ ├── create-deployment.md │ ├── create-duplicate-deployment.md │ ├── create-execution.md │ ├── create-template-deployment.md │ ├── create-variable.md │ ├── create-vcs-deployment.md │ ├── create.md │ ├── delete-deployment.md │ ├── delete-execution.md │ ├── delete-variable.md │ ├── delete.md │ ├── get-deployment-download.md │ ├── get-deployment.md │ ├── get-execution.md │ ├── get-template.md │ ├── get-usage.md │ ├── get-variable.md │ ├── get.md │ ├── list-deployments.md │ ├── list-executions.md │ ├── list-runtimes.md │ ├── list-specifications.md │ ├── list-templates.md │ ├── list-usage.md │ ├── list-variables.md │ ├── list.md │ ├── update-deployment-status.md │ ├── update-function-deployment.md │ ├── update-variable.md │ └── update.md │ ├── graphql │ ├── mutation.md │ └── query.md │ ├── health │ ├── get-antivirus.md │ ├── get-cache.md │ ├── get-certificate.md │ ├── get-d-b.md │ ├── get-failed-jobs.md │ ├── get-pub-sub.md │ ├── get-queue-builds.md │ ├── get-queue-certificates.md │ ├── get-queue-databases.md │ ├── get-queue-deletes.md │ ├── get-queue-functions.md │ ├── get-queue-logs.md │ ├── get-queue-mails.md │ ├── get-queue-messaging.md │ ├── get-queue-migrations.md │ ├── get-queue-stats-resources.md │ ├── get-queue-usage.md │ ├── get-queue-webhooks.md │ ├── get-storage-local.md │ ├── get-storage.md │ ├── get-time.md │ └── get.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-apns-provider.md │ ├── create-email.md │ ├── create-fcm-provider.md │ ├── create-mailgun-provider.md │ ├── create-msg91provider.md │ ├── create-push.md │ ├── create-sendgrid-provider.md │ ├── create-sms.md │ ├── create-smtp-provider.md │ ├── create-subscriber.md │ ├── create-telesign-provider.md │ ├── create-textmagic-provider.md │ ├── create-topic.md │ ├── create-twilio-provider.md │ ├── create-vonage-provider.md │ ├── delete-provider.md │ ├── delete-subscriber.md │ ├── delete-topic.md │ ├── delete.md │ ├── get-message.md │ ├── get-provider.md │ ├── get-subscriber.md │ ├── get-topic.md │ ├── list-message-logs.md │ ├── list-messages.md │ ├── list-provider-logs.md │ ├── list-providers.md │ ├── list-subscriber-logs.md │ ├── list-subscribers.md │ ├── list-targets.md │ ├── list-topic-logs.md │ ├── list-topics.md │ ├── update-apns-provider.md │ ├── update-email.md │ ├── update-fcm-provider.md │ ├── update-mailgun-provider.md │ ├── update-msg91provider.md │ ├── update-push.md │ ├── update-sendgrid-provider.md │ ├── update-sms.md │ ├── update-smtp-provider.md │ ├── update-telesign-provider.md │ ├── update-textmagic-provider.md │ ├── update-topic.md │ ├── update-twilio-provider.md │ └── update-vonage-provider.md │ ├── migrations │ ├── create-appwrite-migration.md │ ├── create-csv-migration.md │ ├── create-firebase-migration.md │ ├── create-n-host-migration.md │ ├── create-supabase-migration.md │ ├── delete.md │ ├── get-appwrite-report.md │ ├── get-firebase-report.md │ ├── get-n-host-report.md │ ├── get-supabase-report.md │ ├── get.md │ ├── list.md │ └── retry.md │ ├── project │ ├── create-variable.md │ ├── delete-variable.md │ ├── get-usage.md │ ├── get-variable.md │ ├── list-variables.md │ └── update-variable.md │ ├── projects │ ├── create-dev-key.md │ ├── create-j-w-t.md │ ├── create-key.md │ ├── create-platform.md │ ├── create-smtp-test.md │ ├── create-webhook.md │ ├── create.md │ ├── delete-dev-key.md │ ├── delete-email-template.md │ ├── delete-key.md │ ├── delete-platform.md │ ├── delete-sms-template.md │ ├── delete-webhook.md │ ├── delete.md │ ├── get-dev-key.md │ ├── get-email-template.md │ ├── get-key.md │ ├── get-platform.md │ ├── get-sms-template.md │ ├── get-webhook.md │ ├── get.md │ ├── list-dev-keys.md │ ├── list-keys.md │ ├── list-platforms.md │ ├── list-webhooks.md │ ├── list.md │ ├── update-api-status-all.md │ ├── update-api-status.md │ ├── update-auth-duration.md │ ├── update-auth-limit.md │ ├── update-auth-password-dictionary.md │ ├── update-auth-password-history.md │ ├── update-auth-sessions-limit.md │ ├── update-auth-status.md │ ├── update-dev-key.md │ ├── update-email-template.md │ ├── update-key.md │ ├── update-memberships-privacy.md │ ├── update-mock-numbers.md │ ├── update-o-auth2.md │ ├── update-personal-data-check.md │ ├── update-platform.md │ ├── update-service-status-all.md │ ├── update-service-status.md │ ├── update-session-alerts.md │ ├── update-sms-template.md │ ├── update-smtp.md │ ├── update-team.md │ ├── update-webhook-signature.md │ ├── update-webhook.md │ └── update.md │ ├── proxy │ ├── create-a-p-i-rule.md │ ├── create-function-rule.md │ ├── create-redirect-rule.md │ ├── create-site-rule.md │ ├── delete-rule.md │ ├── get-rule.md │ ├── list-rules.md │ └── update-rule-verification.md │ ├── sites │ ├── create-deployment.md │ ├── create-duplicate-deployment.md │ ├── create-template-deployment.md │ ├── create-variable.md │ ├── create-vcs-deployment.md │ ├── create.md │ ├── delete-deployment.md │ ├── delete-log.md │ ├── delete-variable.md │ ├── delete.md │ ├── get-deployment-download.md │ ├── get-deployment.md │ ├── get-log.md │ ├── get-template.md │ ├── get-usage.md │ ├── get-variable.md │ ├── get.md │ ├── list-deployments.md │ ├── list-frameworks.md │ ├── list-logs.md │ ├── list-specifications.md │ ├── list-templates.md │ ├── list-usage.md │ ├── list-variables.md │ ├── list.md │ ├── update-deployment-status.md │ ├── update-site-deployment.md │ ├── update-variable.md │ └── update.md │ ├── storage │ ├── create-bucket.md │ ├── create-file.md │ ├── delete-bucket.md │ ├── delete-file.md │ ├── get-bucket-usage.md │ ├── get-bucket.md │ ├── get-file-download.md │ ├── get-file-preview.md │ ├── get-file-view.md │ ├── get-file.md │ ├── get-usage.md │ ├── list-buckets.md │ ├── list-files.md │ ├── update-bucket.md │ └── update-file.md │ ├── teams │ ├── create-membership.md │ ├── create.md │ ├── delete-membership.md │ ├── delete.md │ ├── get-membership.md │ ├── get-prefs.md │ ├── get.md │ ├── list-logs.md │ ├── list-memberships.md │ ├── list.md │ ├── update-membership-status.md │ ├── update-membership.md │ ├── update-name.md │ └── update-prefs.md │ ├── tokens │ ├── create-file-token.md │ ├── delete.md │ ├── get.md │ ├── list.md │ └── update.md │ ├── users │ ├── create-argon2user.md │ ├── create-bcrypt-user.md │ ├── create-j-w-t.md │ ├── create-m-d5user.md │ ├── create-mfa-recovery-codes.md │ ├── create-p-h-pass-user.md │ ├── create-s-h-a-user.md │ ├── create-scrypt-modified-user.md │ ├── create-scrypt-user.md │ ├── create-session.md │ ├── create-target.md │ ├── create-token.md │ ├── create.md │ ├── delete-identity.md │ ├── delete-mfa-authenticator.md │ ├── delete-session.md │ ├── delete-sessions.md │ ├── delete-target.md │ ├── delete.md │ ├── get-mfa-recovery-codes.md │ ├── get-prefs.md │ ├── get-target.md │ ├── get-usage.md │ ├── get.md │ ├── list-identities.md │ ├── list-logs.md │ ├── list-memberships.md │ ├── list-mfa-factors.md │ ├── list-sessions.md │ ├── list-targets.md │ ├── list.md │ ├── update-email-verification.md │ ├── update-email.md │ ├── update-labels.md │ ├── update-mfa-recovery-codes.md │ ├── update-mfa.md │ ├── update-name.md │ ├── update-password.md │ ├── update-phone-verification.md │ ├── update-phone.md │ ├── update-prefs.md │ ├── update-status.md │ └── update-target.md │ └── vcs │ ├── create-repository-detection.md │ ├── create-repository.md │ ├── delete-installation.md │ ├── get-installation.md │ ├── get-repository-contents.md │ ├── get-repository.md │ ├── list-installations.md │ ├── list-repositories.md │ ├── list-repository-branches.md │ └── update-external-deployments.md ├── index.js ├── install.ps1 ├── install.sh ├── lib ├── client.js ├── commands │ ├── account.js │ ├── assistant.js │ ├── avatars.js │ ├── console.js │ ├── databases.js │ ├── functions.js │ ├── generic.js │ ├── graphql.js │ ├── health.js │ ├── init.js │ ├── locale.js │ ├── messaging.js │ ├── migrations.js │ ├── organizations.js │ ├── project.js │ ├── projects.js │ ├── proxy.js │ ├── pull.js │ ├── push.js │ ├── run.js │ ├── sites.js │ ├── storage.js │ ├── teams.js │ ├── tokens.js │ ├── users.js │ └── vcs.js ├── config.js ├── emulation │ ├── docker.js │ └── utils.js ├── exception.js ├── id.js ├── paginate.js ├── parser.js ├── questions.js ├── sdks.js ├── spinner.js ├── utils.js └── validations.js ├── package.json └── scoop └── appwrite.json /.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/npm-publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish Package to npmjs 2 | on: 3 | release: 4 | types: [published] 5 | jobs: 6 | build-for-linux-and-windows: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v2 10 | - uses: actions/setup-node@v2 11 | with: 12 | node-version: '16.x' 13 | registry-url: 'https://registry.npmjs.org' 14 | - name: Setup binfmt with QEMU 15 | run: | 16 | sudo apt update 17 | sudo apt install qemu-system binfmt-support qemu-user-static 18 | update-binfmts --display 19 | - name: Setup ldid 20 | run: | 21 | git clone https://github.com/tpoechtrager/ldid 22 | cd ./ldid 23 | sudo make 24 | sudo make install 25 | - name: Install dependenices and build for Linux and Windows 26 | run: | 27 | npm install 28 | npm run linux-x64 29 | npm run linux-arm64 30 | npm run windows-x64 31 | npm run windows-arm64 32 | npm run mac-x64 33 | npm run mac-arm64 34 | - name: Publish NPM library 35 | run: | 36 | if ${{ contains(github.event.release.tag_name, '-rc') }}; then 37 | echo "Publishing Release Candidate ${{ github.event.release.tag_name}} to NPM" 38 | npm publish --tag next 39 | else 40 | echo "Publishing ${{ github.event.release.tag_name}} to NPM" 41 | npm publish 42 | fi 43 | env: 44 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 45 | - uses: fnkr/github-action-ghr@v1 46 | env: 47 | GHR_PATH: build/ 48 | GHR_REPLACE: false 49 | GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | build/ 3 | .DS_Store -------------------------------------------------------------------------------- /Formula/appwrite.rb: -------------------------------------------------------------------------------- 1 | require "language/node" 2 | 3 | class Appwrite < Formula 4 | desc "CLI is a Node based command-line tool for Appwrite API" 5 | homepage "https://appwrite.io" 6 | license "BSD-3-Clause" 7 | head "https://github.com/appwrite/sdk-for-cli.git", branch: "master" 8 | 9 | depends_on "node" 10 | 11 | def install 12 | system "npm", "install", *Language::Node.std_npm_install_args(libexec) 13 | bin.install_symlink Dir["#{libexec}/bin/*"] 14 | end 15 | 16 | test do 17 | system "true" 18 | end 19 | end -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 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 Command Line SDK 2 | 3 | ![License](https://img.shields.io/github/license/appwrite/sdk-for-cli.svg?style=flat-square) 4 | ![Version](https://img.shields.io/badge/api%20version-1.7.4-blue.svg?style=flat-square) 5 | [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) 6 | [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) 7 | [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](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-cli/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 Command Line 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 | ![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png) 14 | 15 | ## Installation 16 | 17 | The Appwrite CLI is a Node based command line tool to help you interact with the Appwrite API. The CLI is distributed both as an [`npm package`](https://www.npmjs.com/package/appwrite-cli) as well as [pre built binaries](https://github.com/appwrite/sdk-for-cli/releases/latest) for specific operating systems and architectures. 18 | 19 | ### Install using NPM 20 | --- 21 | 22 | If you have `npm` installed, it's as easy as running 23 | 24 | ```sh 25 | $ npm install -g appwrite-cli 26 | ``` 27 | 28 | Once the installation is complete, you can verify the install using 29 | 30 | ```sh 31 | $ appwrite -v 32 | 7.0.0 33 | ``` 34 | 35 | ### Install using prebuilt binaries 36 | --- 37 | 38 | If you do not have `npm` installed, you can always install the prebuilt binaries for your architecture and OS using our convenient installation scripts. 39 | 40 | ### Linux / MacOS Terminal 41 | ```bash 42 | $ wget -q https://appwrite.io/cli/install.sh -O - | /bin/bash 43 | ``` 44 | 45 | ### MacOS via [Homebrew](https://brew.sh) 46 | ```bash 47 | $ brew install appwrite 48 | ``` 49 | 50 | ### Windows 51 | Via Powershell 52 | ```powershell 53 | $ iwr -useb https://appwrite.io/cli/install.ps1 | iex 54 | ``` 55 | Via [Scoop](https://scoop.sh) 56 | ```powershell 57 | $ scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/scoop/appwrite.json 58 | ``` 59 | 60 | Once the installation completes, you can verify your install using 61 | ``` 62 | $ appwrite -v 63 | 7.0.0 64 | ``` 65 | 66 | ## Getting Started 67 | 68 | Before you can use the CLI, you need to login to your Appwrite account. 69 | 70 | ```sh 71 | $ appwrite login 72 | 73 | ? Enter your email test@test.com 74 | ? Enter your password ******** 75 | ✓ Success 76 | ``` 77 | This will also prompt you to enter your Appwrite endpoint ( default: http://localhost/v1 ) 78 | 79 | * ### Initialising your project 80 | Once logged in, the CLI needs to be initialised before you can use it with your Appwrite project. You can do this with the `appwrite init project` command. 81 | 82 | ```sh 83 | $ appwrite init project 84 | ``` 85 | 86 | The following prompt will guide you through the setup process. The `init` command also creates an `appwrite.json` file representing your Appwrite project. 87 | 88 | The `appwrite.json` file does a lot of things. 89 | * Provides context to the CLI 90 | * Keeps track of all your cloud functions 91 | * Keeps track of all your project's collections 92 | * Helps you deploy your Appwrite project to production and more.. 93 | 94 | You can also fetch all the collections in your current project using 95 | ```sh 96 | appwrite init collection 97 | ``` 98 | 99 | * ### Creating and deploying cloud functions 100 | 101 | The CLI makes it extremely easy to create and deploy Appwrite's cloud functions. Initialise your new function using 102 | 103 | ``` 104 | $ appwrite init function 105 | ? What would you like to name your function? My Awesome Function 106 | ? What runtime would you like to use? Node.js (node-15.5) 107 | ✓ Success 108 | ``` 109 | 110 | This will create a new function `My Awesome Function` in your current Appwrite project and also create a template function for you to get started. 111 | 112 | ```sh 113 | $ tree My\ Awesome\ Function 114 | 115 | My Awesome Function 116 | ├── README.md 117 | ├── index.js 118 | ├── package-lock.json 119 | └── package.json 120 | 121 | 0 directories, 4 files 122 | ``` 123 | 124 | You can now deploy this function using 125 | 126 | ```sh 127 | $ appwrite push function 128 | 129 | ? Which functions would you like to deploy? My Awesome Function (61d1a4c81dfcd95bc834) 130 | ℹ Info Deploying function My Awesome Function ( 61d1a4c81dfcd95bc834 ) 131 | ✓ Success Deployed My Awesome Function ( 61d1a4c81dfcd95bc834 ) 132 | ``` 133 | 134 | Your function has now been deployed on your Appwrite server! As soon as the build process is finished, you can start executing the function. 135 | 136 | * ### Deploying Collections 137 | 138 | Similarly, you can deploy all your collections to your Appwrite server using 139 | 140 | ```sh 141 | appwrite push collections 142 | ``` 143 | 144 | > ### Note 145 | > By default, requests to domains with self signed SSL certificates (or no certificates) are disabled. If you trust the domain, you can bypass the certificate validation using 146 | ```sh 147 | $ appwrite client --selfSigned true 148 | ``` 149 | 150 | ## Usage 151 | 152 | The Appwrite CLI follows the following general syntax. 153 | ```sh 154 | $ appwrite [COMMAND] --[OPTIONS] 155 | ``` 156 | 157 | A few sample commands to get you started 158 | 159 | ```sh 160 | $ appwrite users create --userId "unique()" --email hello@appwrite.io --password very_strong_password 161 | $ appwrite users list 162 | ``` 163 | 164 | To create a document you can use the following command 165 | ```sh 166 | $ appwrite databases create-document --database-id --collection-id --document-id "unique()" --data '{"name": "Walter O Brein"}' --permissions 'read("any")' 'read("team:abc")' 167 | ``` 168 | 169 | ### Some Gotchas 170 | - `data` must be a valid JSON string where each key and value are enclosed in double quotes `"` like the example above. 171 | - Some arguments like the `read` and `write` permissions are expected to be arrays. In the Appwrite CLI, array values are passed in using space as a separator like in the example above. 172 | 173 | 174 | To get information about the different services available, you can use 175 | ```sh 176 | $ appwrite -h 177 | ``` 178 | 179 | To get information about a particular service and the commands available in a service you can use 180 | ```sh 181 | $ appwrite users // or 182 | $ appwrite users --help // or 183 | $ appwrite users help // or 184 | $ appwrite accounts 185 | ``` 186 | 187 | To get information about a particular command and the parameters it accepts, you can use 188 | 189 | ```sh 190 | $ appwrite users list --help 191 | $ appwrite account get --help 192 | ``` 193 | 194 | At any point, you can view or reset the CLI configuration using the `client` service. 195 | 196 | ``` 197 | $ appwrite client --debug 198 | // This will display your endpoint, projectID, API key and so on. 199 | $ appwrite client --reset 200 | ``` 201 | 202 | ## CI mode 203 | 204 | The Appwrite CLI can also work in a CI environment. The initialisation of the CLI works a bit differently in CI. In CI, you set your `endpoint`, `projectId` and `API Key` using 205 | 206 | ```sh 207 | appwrite client --endpoint http://localhost/v1 --projectId --key 208 | ``` 209 | 210 | 211 | ## Contribution 212 | 213 | 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. 214 | 215 | To build and test the CLI for development, follow these steps 216 | 217 | 1. Clone the SDK Generator repository and cd into the directory 218 | ```sh 219 | $ git clone https://github.com/appwrite/sdk-generator 220 | $ cd sdk-generator 221 | ``` 222 | 223 | 2. Ensure Docker is running locally and then install the composer dependencies using 224 | ```sh 225 | $ docker run --rm --interactive --tty --volume "$(pwd)":/app composer install --ignore-platform-reqs --optimize-autoloader --no-plugins --no-scripts --prefer-dist 226 | 227 | # Generate the SDKs 228 | $ docker run --rm -v $(pwd):/app -w /app php:8.1-cli php example.php 229 | ``` 230 | 231 | 3. Head over to the generated SDK and install the dependencies. 232 | ```sh 233 | $ cd examples/cli 234 | $ npm install 235 | ``` 236 | 237 | 4. Install the CLI using 238 | ```sh 239 | $ npm install -g . 240 | ``` 241 | 242 | 5. You can now use the CLI 243 | ```sh 244 | $ appwrite -v 245 | ``` 246 | ## License 247 | 248 | Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. 249 | -------------------------------------------------------------------------------- /docs/examples/account/create-anonymous-session.md: -------------------------------------------------------------------------------- 1 | appwrite account createAnonymousSession 2 | -------------------------------------------------------------------------------- /docs/examples/account/create-email-password-session.md: -------------------------------------------------------------------------------- 1 | appwrite account createEmailPasswordSession \ 2 | --email email@example.com \ 3 | --password password 4 | -------------------------------------------------------------------------------- /docs/examples/account/create-email-token.md: -------------------------------------------------------------------------------- 1 | appwrite account createEmailToken \ 2 | --userId \ 3 | --email email@example.com \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/account/create-j-w-t.md: -------------------------------------------------------------------------------- 1 | appwrite account createJWT 2 | -------------------------------------------------------------------------------- /docs/examples/account/create-magic-u-r-l-token.md: -------------------------------------------------------------------------------- 1 | appwrite account createMagicURLToken \ 2 | --userId \ 3 | --email email@example.com \ 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/account/create-mfa-authenticator.md: -------------------------------------------------------------------------------- 1 | appwrite account createMfaAuthenticator \ 2 | --type totp 3 | -------------------------------------------------------------------------------- /docs/examples/account/create-mfa-challenge.md: -------------------------------------------------------------------------------- 1 | appwrite account createMfaChallenge \ 2 | --factor email 3 | -------------------------------------------------------------------------------- /docs/examples/account/create-mfa-recovery-codes.md: -------------------------------------------------------------------------------- 1 | appwrite account createMfaRecoveryCodes 2 | -------------------------------------------------------------------------------- /docs/examples/account/create-o-auth2session.md: -------------------------------------------------------------------------------- 1 | appwrite account createOAuth2Session \ 2 | --provider amazon \ 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/account/create-o-auth2token.md: -------------------------------------------------------------------------------- 1 | appwrite account createOAuth2Token \ 2 | --provider amazon \ 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/account/create-phone-token.md: -------------------------------------------------------------------------------- 1 | appwrite account createPhoneToken \ 2 | --userId \ 3 | --phone +12065550100 4 | -------------------------------------------------------------------------------- /docs/examples/account/create-phone-verification.md: -------------------------------------------------------------------------------- 1 | appwrite account createPhoneVerification 2 | -------------------------------------------------------------------------------- /docs/examples/account/create-push-target.md: -------------------------------------------------------------------------------- 1 | appwrite account createPushTarget \ 2 | --targetId \ 3 | --identifier \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/account/create-recovery.md: -------------------------------------------------------------------------------- 1 | appwrite account createRecovery \ 2 | --email email@example.com \ 3 | --url https://example.com 4 | -------------------------------------------------------------------------------- /docs/examples/account/create-session.md: -------------------------------------------------------------------------------- 1 | appwrite account createSession \ 2 | --userId \ 3 | --secret 4 | -------------------------------------------------------------------------------- /docs/examples/account/create-verification.md: -------------------------------------------------------------------------------- 1 | appwrite account createVerification \ 2 | --url https://example.com 3 | -------------------------------------------------------------------------------- /docs/examples/account/create.md: -------------------------------------------------------------------------------- 1 | appwrite account create \ 2 | --userId \ 3 | --email email@example.com \ 4 | --password '' \ 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/account/delete-identity.md: -------------------------------------------------------------------------------- 1 | appwrite account deleteIdentity \ 2 | --identityId 3 | -------------------------------------------------------------------------------- /docs/examples/account/delete-mfa-authenticator.md: -------------------------------------------------------------------------------- 1 | appwrite account deleteMfaAuthenticator \ 2 | --type totp 3 | -------------------------------------------------------------------------------- /docs/examples/account/delete-push-target.md: -------------------------------------------------------------------------------- 1 | appwrite account deletePushTarget \ 2 | --targetId 3 | -------------------------------------------------------------------------------- /docs/examples/account/delete-session.md: -------------------------------------------------------------------------------- 1 | appwrite account deleteSession \ 2 | --sessionId 3 | -------------------------------------------------------------------------------- /docs/examples/account/delete-sessions.md: -------------------------------------------------------------------------------- 1 | appwrite account deleteSessions 2 | -------------------------------------------------------------------------------- /docs/examples/account/delete.md: -------------------------------------------------------------------------------- 1 | appwrite account delete 2 | -------------------------------------------------------------------------------- /docs/examples/account/get-mfa-recovery-codes.md: -------------------------------------------------------------------------------- 1 | appwrite account getMfaRecoveryCodes 2 | -------------------------------------------------------------------------------- /docs/examples/account/get-prefs.md: -------------------------------------------------------------------------------- 1 | appwrite account getPrefs 2 | -------------------------------------------------------------------------------- /docs/examples/account/get-session.md: -------------------------------------------------------------------------------- 1 | appwrite account getSession \ 2 | --sessionId 3 | -------------------------------------------------------------------------------- /docs/examples/account/get.md: -------------------------------------------------------------------------------- 1 | appwrite account get 2 | -------------------------------------------------------------------------------- /docs/examples/account/list-identities.md: -------------------------------------------------------------------------------- 1 | appwrite account listIdentities \ 2 | 3 | -------------------------------------------------------------------------------- /docs/examples/account/list-logs.md: -------------------------------------------------------------------------------- 1 | appwrite account listLogs \ 2 | 3 | -------------------------------------------------------------------------------- /docs/examples/account/list-mfa-factors.md: -------------------------------------------------------------------------------- 1 | appwrite account listMfaFactors 2 | -------------------------------------------------------------------------------- /docs/examples/account/list-sessions.md: -------------------------------------------------------------------------------- 1 | appwrite account listSessions 2 | -------------------------------------------------------------------------------- /docs/examples/account/update-email.md: -------------------------------------------------------------------------------- 1 | appwrite account updateEmail \ 2 | --email email@example.com \ 3 | --password password 4 | -------------------------------------------------------------------------------- /docs/examples/account/update-m-f-a.md: -------------------------------------------------------------------------------- 1 | appwrite account updateMFA \ 2 | --mfa false 3 | -------------------------------------------------------------------------------- /docs/examples/account/update-magic-u-r-l-session.md: -------------------------------------------------------------------------------- 1 | appwrite account updateMagicURLSession \ 2 | --userId \ 3 | --secret 4 | -------------------------------------------------------------------------------- /docs/examples/account/update-mfa-authenticator.md: -------------------------------------------------------------------------------- 1 | appwrite account updateMfaAuthenticator \ 2 | --type totp \ 3 | --otp 4 | -------------------------------------------------------------------------------- /docs/examples/account/update-mfa-challenge.md: -------------------------------------------------------------------------------- 1 | appwrite account updateMfaChallenge \ 2 | --challengeId \ 3 | --otp 4 | -------------------------------------------------------------------------------- /docs/examples/account/update-mfa-recovery-codes.md: -------------------------------------------------------------------------------- 1 | appwrite account updateMfaRecoveryCodes 2 | -------------------------------------------------------------------------------- /docs/examples/account/update-name.md: -------------------------------------------------------------------------------- 1 | appwrite account updateName \ 2 | --name 3 | -------------------------------------------------------------------------------- /docs/examples/account/update-password.md: -------------------------------------------------------------------------------- 1 | appwrite account updatePassword \ 2 | --password '' \ 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/account/update-phone-session.md: -------------------------------------------------------------------------------- 1 | appwrite account updatePhoneSession \ 2 | --userId \ 3 | --secret 4 | -------------------------------------------------------------------------------- /docs/examples/account/update-phone-verification.md: -------------------------------------------------------------------------------- 1 | appwrite account updatePhoneVerification \ 2 | --userId \ 3 | --secret 4 | -------------------------------------------------------------------------------- /docs/examples/account/update-phone.md: -------------------------------------------------------------------------------- 1 | appwrite account updatePhone \ 2 | --phone +12065550100 \ 3 | --password password 4 | -------------------------------------------------------------------------------- /docs/examples/account/update-prefs.md: -------------------------------------------------------------------------------- 1 | appwrite account updatePrefs \ 2 | --prefs '{ "key": "value" }' 3 | -------------------------------------------------------------------------------- /docs/examples/account/update-push-target.md: -------------------------------------------------------------------------------- 1 | appwrite account updatePushTarget \ 2 | --targetId \ 3 | --identifier 4 | -------------------------------------------------------------------------------- /docs/examples/account/update-recovery.md: -------------------------------------------------------------------------------- 1 | appwrite account updateRecovery \ 2 | --userId \ 3 | --secret \ 4 | --password '' 5 | -------------------------------------------------------------------------------- /docs/examples/account/update-session.md: -------------------------------------------------------------------------------- 1 | appwrite account updateSession \ 2 | --sessionId 3 | -------------------------------------------------------------------------------- /docs/examples/account/update-status.md: -------------------------------------------------------------------------------- 1 | appwrite account updateStatus 2 | -------------------------------------------------------------------------------- /docs/examples/account/update-verification.md: -------------------------------------------------------------------------------- 1 | appwrite account updateVerification \ 2 | --userId \ 3 | --secret 4 | -------------------------------------------------------------------------------- /docs/examples/assistant/chat.md: -------------------------------------------------------------------------------- 1 | appwrite assistant chat \ 2 | --prompt 3 | -------------------------------------------------------------------------------- /docs/examples/avatars/get-browser.md: -------------------------------------------------------------------------------- 1 | appwrite avatars getBrowser \ 2 | --code aa \ 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/avatars/get-credit-card.md: -------------------------------------------------------------------------------- 1 | appwrite avatars getCreditCard \ 2 | --code amex \ 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/avatars/get-favicon.md: -------------------------------------------------------------------------------- 1 | appwrite avatars getFavicon \ 2 | --url https://example.com 3 | -------------------------------------------------------------------------------- /docs/examples/avatars/get-flag.md: -------------------------------------------------------------------------------- 1 | appwrite avatars getFlag \ 2 | --code af \ 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/avatars/get-image.md: -------------------------------------------------------------------------------- 1 | appwrite avatars getImage \ 2 | --url https://example.com \ 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/avatars/get-initials.md: -------------------------------------------------------------------------------- 1 | appwrite avatars getInitials \ 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/avatars/get-q-r.md: -------------------------------------------------------------------------------- 1 | appwrite avatars getQR \ 2 | --text \ 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/console/get-resource.md: -------------------------------------------------------------------------------- 1 | appwrite console getResource \ 2 | --value \ 3 | --type rules 4 | -------------------------------------------------------------------------------- /docs/examples/console/variables.md: -------------------------------------------------------------------------------- 1 | appwrite console variables 2 | -------------------------------------------------------------------------------- /docs/examples/databases/create-boolean-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases createBooleanAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' \ 5 | --required false \ 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/databases/create-collection.md: -------------------------------------------------------------------------------- 1 | appwrite databases createCollection \ 2 | --databaseId \ 3 | --collectionId \ 4 | --name \ 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/databases/create-datetime-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases createDatetimeAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' \ 5 | --required false \ 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/databases/create-document.md: -------------------------------------------------------------------------------- 1 | appwrite databases createDocument \ 2 | --databaseId \ 3 | --collectionId \ 4 | --documentId \ 5 | --data '{ "key": "value" }' \ 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/databases/create-documents.md: -------------------------------------------------------------------------------- 1 | appwrite databases createDocuments \ 2 | --databaseId \ 3 | --collectionId \ 4 | --documents one two three 5 | -------------------------------------------------------------------------------- /docs/examples/databases/create-email-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases createEmailAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' \ 5 | --required false \ 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/databases/create-enum-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases createEnumAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' \ 5 | --elements one two three \ 6 | --required false \ 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/examples/databases/create-float-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases createFloatAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' \ 5 | --required false \ 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/examples/databases/create-index.md: -------------------------------------------------------------------------------- 1 | appwrite databases createIndex \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' \ 5 | --type key \ 6 | --attributes one two three \ 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/examples/databases/create-integer-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases createIntegerAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' \ 5 | --required false \ 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/examples/databases/create-ip-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases createIpAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' \ 5 | --required false \ 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/databases/create-relationship-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases createRelationshipAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --relatedCollectionId \ 5 | --type oneToOne \ 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/examples/databases/create-string-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases createStringAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' \ 5 | --size 1 \ 6 | --required false \ 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/examples/databases/create-url-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases createUrlAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' \ 5 | --required false \ 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/databases/create.md: -------------------------------------------------------------------------------- 1 | appwrite databases create \ 2 | --databaseId \ 3 | --name \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/databases/delete-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases deleteAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' 5 | -------------------------------------------------------------------------------- /docs/examples/databases/delete-collection.md: -------------------------------------------------------------------------------- 1 | appwrite databases deleteCollection \ 2 | --databaseId \ 3 | --collectionId 4 | -------------------------------------------------------------------------------- /docs/examples/databases/delete-document.md: -------------------------------------------------------------------------------- 1 | appwrite databases deleteDocument \ 2 | --databaseId \ 3 | --collectionId \ 4 | --documentId 5 | -------------------------------------------------------------------------------- /docs/examples/databases/delete-documents.md: -------------------------------------------------------------------------------- 1 | appwrite databases deleteDocuments \ 2 | --databaseId \ 3 | --collectionId \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/databases/delete-index.md: -------------------------------------------------------------------------------- 1 | appwrite databases deleteIndex \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' 5 | -------------------------------------------------------------------------------- /docs/examples/databases/delete.md: -------------------------------------------------------------------------------- 1 | appwrite databases delete \ 2 | --databaseId 3 | -------------------------------------------------------------------------------- /docs/examples/databases/get-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases getAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' 5 | -------------------------------------------------------------------------------- /docs/examples/databases/get-collection-usage.md: -------------------------------------------------------------------------------- 1 | appwrite databases getCollectionUsage \ 2 | --databaseId \ 3 | --collectionId \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/databases/get-collection.md: -------------------------------------------------------------------------------- 1 | appwrite databases getCollection \ 2 | --databaseId \ 3 | --collectionId 4 | -------------------------------------------------------------------------------- /docs/examples/databases/get-database-usage.md: -------------------------------------------------------------------------------- 1 | appwrite databases getDatabaseUsage \ 2 | --databaseId \ 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/databases/get-document.md: -------------------------------------------------------------------------------- 1 | appwrite databases getDocument \ 2 | --databaseId \ 3 | --collectionId \ 4 | --documentId \ 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/databases/get-index.md: -------------------------------------------------------------------------------- 1 | appwrite databases getIndex \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' 5 | -------------------------------------------------------------------------------- /docs/examples/databases/get-usage.md: -------------------------------------------------------------------------------- 1 | appwrite databases getUsage \ 2 | 3 | -------------------------------------------------------------------------------- /docs/examples/databases/get.md: -------------------------------------------------------------------------------- 1 | appwrite databases get \ 2 | --databaseId 3 | -------------------------------------------------------------------------------- /docs/examples/databases/list-attributes.md: -------------------------------------------------------------------------------- 1 | appwrite databases listAttributes \ 2 | --databaseId \ 3 | --collectionId \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/databases/list-collection-logs.md: -------------------------------------------------------------------------------- 1 | appwrite databases listCollectionLogs \ 2 | --databaseId \ 3 | --collectionId \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/databases/list-collections.md: -------------------------------------------------------------------------------- 1 | appwrite databases listCollections \ 2 | --databaseId \ 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/databases/list-document-logs.md: -------------------------------------------------------------------------------- 1 | appwrite databases listDocumentLogs \ 2 | --databaseId \ 3 | --collectionId \ 4 | --documentId \ 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/databases/list-documents.md: -------------------------------------------------------------------------------- 1 | appwrite databases listDocuments \ 2 | --databaseId \ 3 | --collectionId \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/databases/list-indexes.md: -------------------------------------------------------------------------------- 1 | appwrite databases listIndexes \ 2 | --databaseId \ 3 | --collectionId \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/databases/list-logs.md: -------------------------------------------------------------------------------- 1 | appwrite databases listLogs \ 2 | --databaseId \ 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/databases/list.md: -------------------------------------------------------------------------------- 1 | appwrite databases list \ 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/databases/update-boolean-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases updateBooleanAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' \ 5 | --required false \ 6 | --default false \ 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/databases/update-collection.md: -------------------------------------------------------------------------------- 1 | appwrite databases updateCollection \ 2 | --databaseId \ 3 | --collectionId \ 4 | --name \ 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/databases/update-datetime-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases updateDatetimeAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' \ 5 | --required false \ 6 | --default '' \ 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/databases/update-document.md: -------------------------------------------------------------------------------- 1 | appwrite databases updateDocument \ 2 | --databaseId \ 3 | --collectionId \ 4 | --documentId \ 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/databases/update-documents.md: -------------------------------------------------------------------------------- 1 | appwrite databases updateDocuments \ 2 | --databaseId \ 3 | --collectionId \ 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/databases/update-email-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases updateEmailAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' \ 5 | --required false \ 6 | --default email@example.com \ 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/databases/update-enum-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases updateEnumAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' \ 5 | --elements one two three \ 6 | --required false \ 7 | --default \ 8 | 9 | -------------------------------------------------------------------------------- /docs/examples/databases/update-float-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases updateFloatAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' \ 5 | --required false \ 6 | --default null \ 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/examples/databases/update-integer-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases updateIntegerAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' \ 5 | --required false \ 6 | --default null \ 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/examples/databases/update-ip-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases updateIpAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' \ 5 | --required false \ 6 | --default '' \ 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/databases/update-relationship-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases updateRelationshipAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' \ 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/databases/update-string-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases updateStringAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' \ 5 | --required false \ 6 | --default \ 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/examples/databases/update-url-attribute.md: -------------------------------------------------------------------------------- 1 | appwrite databases updateUrlAttribute \ 2 | --databaseId \ 3 | --collectionId \ 4 | --key '' \ 5 | --required false \ 6 | --default https://example.com \ 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/databases/update.md: -------------------------------------------------------------------------------- 1 | appwrite databases update \ 2 | --databaseId \ 3 | --name \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/databases/upsert-document.md: -------------------------------------------------------------------------------- 1 | appwrite databases upsertDocument \ 2 | --databaseId \ 3 | --collectionId \ 4 | --documentId \ 5 | --data '{ "key": "value" }' \ 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/databases/upsert-documents.md: -------------------------------------------------------------------------------- 1 | appwrite databases upsertDocuments \ 2 | --databaseId \ 3 | --collectionId \ 4 | --documents one two three 5 | -------------------------------------------------------------------------------- /docs/examples/functions/create-deployment.md: -------------------------------------------------------------------------------- 1 | appwrite functions createDeployment \ 2 | --functionId \ 3 | --code 'path/to/file.png' \ 4 | --activate false \ 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/functions/create-duplicate-deployment.md: -------------------------------------------------------------------------------- 1 | appwrite functions createDuplicateDeployment \ 2 | --functionId \ 3 | --deploymentId \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/functions/create-execution.md: -------------------------------------------------------------------------------- 1 | appwrite functions createExecution \ 2 | --functionId \ 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/examples/functions/create-template-deployment.md: -------------------------------------------------------------------------------- 1 | appwrite functions createTemplateDeployment \ 2 | --functionId \ 3 | --repository \ 4 | --owner \ 5 | --rootDirectory \ 6 | --version \ 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/functions/create-variable.md: -------------------------------------------------------------------------------- 1 | appwrite functions createVariable \ 2 | --functionId \ 3 | --key \ 4 | --value \ 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/functions/create-vcs-deployment.md: -------------------------------------------------------------------------------- 1 | appwrite functions createVcsDeployment \ 2 | --functionId \ 3 | --type branch \ 4 | --reference \ 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/functions/create.md: -------------------------------------------------------------------------------- 1 | appwrite functions create \ 2 | --functionId \ 3 | --name \ 4 | --runtime node-14.5 \ 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/examples/functions/delete-deployment.md: -------------------------------------------------------------------------------- 1 | appwrite functions deleteDeployment \ 2 | --functionId \ 3 | --deploymentId 4 | -------------------------------------------------------------------------------- /docs/examples/functions/delete-execution.md: -------------------------------------------------------------------------------- 1 | appwrite functions deleteExecution \ 2 | --functionId \ 3 | --executionId 4 | -------------------------------------------------------------------------------- /docs/examples/functions/delete-variable.md: -------------------------------------------------------------------------------- 1 | appwrite functions deleteVariable \ 2 | --functionId \ 3 | --variableId 4 | -------------------------------------------------------------------------------- /docs/examples/functions/delete.md: -------------------------------------------------------------------------------- 1 | appwrite functions delete \ 2 | --functionId 3 | -------------------------------------------------------------------------------- /docs/examples/functions/get-deployment-download.md: -------------------------------------------------------------------------------- 1 | appwrite functions getDeploymentDownload \ 2 | --functionId \ 3 | --deploymentId \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/functions/get-deployment.md: -------------------------------------------------------------------------------- 1 | appwrite functions getDeployment \ 2 | --functionId \ 3 | --deploymentId 4 | -------------------------------------------------------------------------------- /docs/examples/functions/get-execution.md: -------------------------------------------------------------------------------- 1 | appwrite functions getExecution \ 2 | --functionId \ 3 | --executionId 4 | -------------------------------------------------------------------------------- /docs/examples/functions/get-template.md: -------------------------------------------------------------------------------- 1 | appwrite functions getTemplate \ 2 | --templateId 3 | -------------------------------------------------------------------------------- /docs/examples/functions/get-usage.md: -------------------------------------------------------------------------------- 1 | appwrite functions getUsage \ 2 | --functionId \ 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/functions/get-variable.md: -------------------------------------------------------------------------------- 1 | appwrite functions getVariable \ 2 | --functionId \ 3 | --variableId 4 | -------------------------------------------------------------------------------- /docs/examples/functions/get.md: -------------------------------------------------------------------------------- 1 | appwrite functions get \ 2 | --functionId 3 | -------------------------------------------------------------------------------- /docs/examples/functions/list-deployments.md: -------------------------------------------------------------------------------- 1 | appwrite functions listDeployments \ 2 | --functionId \ 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/functions/list-executions.md: -------------------------------------------------------------------------------- 1 | appwrite functions listExecutions \ 2 | --functionId \ 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/functions/list-runtimes.md: -------------------------------------------------------------------------------- 1 | appwrite functions listRuntimes 2 | -------------------------------------------------------------------------------- /docs/examples/functions/list-specifications.md: -------------------------------------------------------------------------------- 1 | appwrite functions listSpecifications 2 | -------------------------------------------------------------------------------- /docs/examples/functions/list-templates.md: -------------------------------------------------------------------------------- 1 | appwrite functions listTemplates \ 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/functions/list-usage.md: -------------------------------------------------------------------------------- 1 | appwrite functions listUsage \ 2 | 3 | -------------------------------------------------------------------------------- /docs/examples/functions/list-variables.md: -------------------------------------------------------------------------------- 1 | appwrite functions listVariables \ 2 | --functionId 3 | -------------------------------------------------------------------------------- /docs/examples/functions/list.md: -------------------------------------------------------------------------------- 1 | appwrite functions list \ 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/functions/update-deployment-status.md: -------------------------------------------------------------------------------- 1 | appwrite functions updateDeploymentStatus \ 2 | --functionId \ 3 | --deploymentId 4 | -------------------------------------------------------------------------------- /docs/examples/functions/update-function-deployment.md: -------------------------------------------------------------------------------- 1 | appwrite functions updateFunctionDeployment \ 2 | --functionId \ 3 | --deploymentId 4 | -------------------------------------------------------------------------------- /docs/examples/functions/update-variable.md: -------------------------------------------------------------------------------- 1 | appwrite functions updateVariable \ 2 | --functionId \ 3 | --variableId \ 4 | --key \ 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/functions/update.md: -------------------------------------------------------------------------------- 1 | appwrite functions update \ 2 | --functionId \ 3 | --name \ 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/examples/graphql/mutation.md: -------------------------------------------------------------------------------- 1 | appwrite graphql mutation \ 2 | --query '{ "key": "value" }' 3 | -------------------------------------------------------------------------------- /docs/examples/graphql/query.md: -------------------------------------------------------------------------------- 1 | appwrite graphql query \ 2 | --query '{ "key": "value" }' 3 | -------------------------------------------------------------------------------- /docs/examples/health/get-antivirus.md: -------------------------------------------------------------------------------- 1 | appwrite health getAntivirus 2 | -------------------------------------------------------------------------------- /docs/examples/health/get-cache.md: -------------------------------------------------------------------------------- 1 | appwrite health getCache 2 | -------------------------------------------------------------------------------- /docs/examples/health/get-certificate.md: -------------------------------------------------------------------------------- 1 | appwrite health getCertificate \ 2 | 3 | -------------------------------------------------------------------------------- /docs/examples/health/get-d-b.md: -------------------------------------------------------------------------------- 1 | appwrite health getDB 2 | -------------------------------------------------------------------------------- /docs/examples/health/get-failed-jobs.md: -------------------------------------------------------------------------------- 1 | appwrite health getFailedJobs \ 2 | --name v1-database \ 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/health/get-pub-sub.md: -------------------------------------------------------------------------------- 1 | appwrite health getPubSub 2 | -------------------------------------------------------------------------------- /docs/examples/health/get-queue-builds.md: -------------------------------------------------------------------------------- 1 | appwrite health getQueueBuilds \ 2 | 3 | -------------------------------------------------------------------------------- /docs/examples/health/get-queue-certificates.md: -------------------------------------------------------------------------------- 1 | appwrite health getQueueCertificates \ 2 | 3 | -------------------------------------------------------------------------------- /docs/examples/health/get-queue-databases.md: -------------------------------------------------------------------------------- 1 | appwrite health getQueueDatabases \ 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/health/get-queue-deletes.md: -------------------------------------------------------------------------------- 1 | appwrite health getQueueDeletes \ 2 | 3 | -------------------------------------------------------------------------------- /docs/examples/health/get-queue-functions.md: -------------------------------------------------------------------------------- 1 | appwrite health getQueueFunctions \ 2 | 3 | -------------------------------------------------------------------------------- /docs/examples/health/get-queue-logs.md: -------------------------------------------------------------------------------- 1 | appwrite health getQueueLogs \ 2 | 3 | -------------------------------------------------------------------------------- /docs/examples/health/get-queue-mails.md: -------------------------------------------------------------------------------- 1 | appwrite health getQueueMails \ 2 | 3 | -------------------------------------------------------------------------------- /docs/examples/health/get-queue-messaging.md: -------------------------------------------------------------------------------- 1 | appwrite health getQueueMessaging \ 2 | 3 | -------------------------------------------------------------------------------- /docs/examples/health/get-queue-migrations.md: -------------------------------------------------------------------------------- 1 | appwrite health getQueueMigrations \ 2 | 3 | -------------------------------------------------------------------------------- /docs/examples/health/get-queue-stats-resources.md: -------------------------------------------------------------------------------- 1 | appwrite health getQueueStatsResources \ 2 | 3 | -------------------------------------------------------------------------------- /docs/examples/health/get-queue-usage.md: -------------------------------------------------------------------------------- 1 | appwrite health getQueueUsage \ 2 | 3 | -------------------------------------------------------------------------------- /docs/examples/health/get-queue-webhooks.md: -------------------------------------------------------------------------------- 1 | appwrite health getQueueWebhooks \ 2 | 3 | -------------------------------------------------------------------------------- /docs/examples/health/get-storage-local.md: -------------------------------------------------------------------------------- 1 | appwrite health getStorageLocal 2 | -------------------------------------------------------------------------------- /docs/examples/health/get-storage.md: -------------------------------------------------------------------------------- 1 | appwrite health getStorage 2 | -------------------------------------------------------------------------------- /docs/examples/health/get-time.md: -------------------------------------------------------------------------------- 1 | appwrite health getTime 2 | -------------------------------------------------------------------------------- /docs/examples/health/get.md: -------------------------------------------------------------------------------- 1 | appwrite health get 2 | -------------------------------------------------------------------------------- /docs/examples/locale/get.md: -------------------------------------------------------------------------------- 1 | appwrite locale get 2 | -------------------------------------------------------------------------------- /docs/examples/locale/list-codes.md: -------------------------------------------------------------------------------- 1 | appwrite locale listCodes 2 | -------------------------------------------------------------------------------- /docs/examples/locale/list-continents.md: -------------------------------------------------------------------------------- 1 | appwrite locale listContinents 2 | -------------------------------------------------------------------------------- /docs/examples/locale/list-countries-e-u.md: -------------------------------------------------------------------------------- 1 | appwrite locale listCountriesEU 2 | -------------------------------------------------------------------------------- /docs/examples/locale/list-countries-phones.md: -------------------------------------------------------------------------------- 1 | appwrite locale listCountriesPhones 2 | -------------------------------------------------------------------------------- /docs/examples/locale/list-countries.md: -------------------------------------------------------------------------------- 1 | appwrite locale listCountries 2 | -------------------------------------------------------------------------------- /docs/examples/locale/list-currencies.md: -------------------------------------------------------------------------------- 1 | appwrite locale listCurrencies 2 | -------------------------------------------------------------------------------- /docs/examples/locale/list-languages.md: -------------------------------------------------------------------------------- 1 | appwrite locale listLanguages 2 | -------------------------------------------------------------------------------- /docs/examples/messaging/create-apns-provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging createApnsProvider \ 2 | --providerId \ 3 | --name \ 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/examples/messaging/create-email.md: -------------------------------------------------------------------------------- 1 | appwrite messaging createEmail \ 2 | --messageId \ 3 | --subject \ 4 | --content \ 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/examples/messaging/create-fcm-provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging createFcmProvider \ 2 | --providerId \ 3 | --name \ 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/messaging/create-mailgun-provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging createMailgunProvider \ 2 | --providerId \ 3 | --name \ 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/examples/messaging/create-msg91provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging createMsg91Provider \ 2 | --providerId \ 3 | --name \ 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/messaging/create-push.md: -------------------------------------------------------------------------------- 1 | appwrite messaging createPush \ 2 | --messageId \ 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/examples/messaging/create-sendgrid-provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging createSendgridProvider \ 2 | --providerId \ 3 | --name \ 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/examples/messaging/create-sms.md: -------------------------------------------------------------------------------- 1 | appwrite messaging createSms \ 2 | --messageId \ 3 | --content \ 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/examples/messaging/create-smtp-provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging createSmtpProvider \ 2 | --providerId \ 3 | --name \ 4 | --host \ 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/examples/messaging/create-subscriber.md: -------------------------------------------------------------------------------- 1 | appwrite messaging createSubscriber \ 2 | --topicId \ 3 | --subscriberId \ 4 | --targetId 5 | -------------------------------------------------------------------------------- /docs/examples/messaging/create-telesign-provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging createTelesignProvider \ 2 | --providerId \ 3 | --name \ 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/messaging/create-textmagic-provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging createTextmagicProvider \ 2 | --providerId \ 3 | --name \ 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/messaging/create-topic.md: -------------------------------------------------------------------------------- 1 | appwrite messaging createTopic \ 2 | --topicId \ 3 | --name \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/messaging/create-twilio-provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging createTwilioProvider \ 2 | --providerId \ 3 | --name \ 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/messaging/create-vonage-provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging createVonageProvider \ 2 | --providerId \ 3 | --name \ 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/messaging/delete-provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging deleteProvider \ 2 | --providerId 3 | -------------------------------------------------------------------------------- /docs/examples/messaging/delete-subscriber.md: -------------------------------------------------------------------------------- 1 | appwrite messaging deleteSubscriber \ 2 | --topicId \ 3 | --subscriberId 4 | -------------------------------------------------------------------------------- /docs/examples/messaging/delete-topic.md: -------------------------------------------------------------------------------- 1 | appwrite messaging deleteTopic \ 2 | --topicId 3 | -------------------------------------------------------------------------------- /docs/examples/messaging/delete.md: -------------------------------------------------------------------------------- 1 | appwrite messaging delete \ 2 | --messageId 3 | -------------------------------------------------------------------------------- /docs/examples/messaging/get-message.md: -------------------------------------------------------------------------------- 1 | appwrite messaging getMessage \ 2 | --messageId 3 | -------------------------------------------------------------------------------- /docs/examples/messaging/get-provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging getProvider \ 2 | --providerId 3 | -------------------------------------------------------------------------------- /docs/examples/messaging/get-subscriber.md: -------------------------------------------------------------------------------- 1 | appwrite messaging getSubscriber \ 2 | --topicId \ 3 | --subscriberId 4 | -------------------------------------------------------------------------------- /docs/examples/messaging/get-topic.md: -------------------------------------------------------------------------------- 1 | appwrite messaging getTopic \ 2 | --topicId 3 | -------------------------------------------------------------------------------- /docs/examples/messaging/list-message-logs.md: -------------------------------------------------------------------------------- 1 | appwrite messaging listMessageLogs \ 2 | --messageId \ 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/messaging/list-messages.md: -------------------------------------------------------------------------------- 1 | appwrite messaging listMessages \ 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/messaging/list-provider-logs.md: -------------------------------------------------------------------------------- 1 | appwrite messaging listProviderLogs \ 2 | --providerId \ 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/messaging/list-providers.md: -------------------------------------------------------------------------------- 1 | appwrite messaging listProviders \ 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/messaging/list-subscriber-logs.md: -------------------------------------------------------------------------------- 1 | appwrite messaging listSubscriberLogs \ 2 | --subscriberId \ 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/messaging/list-subscribers.md: -------------------------------------------------------------------------------- 1 | appwrite messaging listSubscribers \ 2 | --topicId \ 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/messaging/list-targets.md: -------------------------------------------------------------------------------- 1 | appwrite messaging listTargets \ 2 | --messageId \ 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/messaging/list-topic-logs.md: -------------------------------------------------------------------------------- 1 | appwrite messaging listTopicLogs \ 2 | --topicId \ 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/messaging/list-topics.md: -------------------------------------------------------------------------------- 1 | appwrite messaging listTopics \ 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/messaging/update-apns-provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging updateApnsProvider \ 2 | --providerId \ 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/examples/messaging/update-email.md: -------------------------------------------------------------------------------- 1 | appwrite messaging updateEmail \ 2 | --messageId \ 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/examples/messaging/update-fcm-provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging updateFcmProvider \ 2 | --providerId \ 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/messaging/update-mailgun-provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging updateMailgunProvider \ 2 | --providerId \ 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/examples/messaging/update-msg91provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging updateMsg91Provider \ 2 | --providerId \ 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/messaging/update-push.md: -------------------------------------------------------------------------------- 1 | appwrite messaging updatePush \ 2 | --messageId \ 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/examples/messaging/update-sendgrid-provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging updateSendgridProvider \ 2 | --providerId \ 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/examples/messaging/update-sms.md: -------------------------------------------------------------------------------- 1 | appwrite messaging updateSms \ 2 | --messageId \ 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/examples/messaging/update-smtp-provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging updateSmtpProvider \ 2 | --providerId \ 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/examples/messaging/update-telesign-provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging updateTelesignProvider \ 2 | --providerId \ 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/messaging/update-textmagic-provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging updateTextmagicProvider \ 2 | --providerId \ 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/messaging/update-topic.md: -------------------------------------------------------------------------------- 1 | appwrite messaging updateTopic \ 2 | --topicId \ 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/messaging/update-twilio-provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging updateTwilioProvider \ 2 | --providerId \ 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/messaging/update-vonage-provider.md: -------------------------------------------------------------------------------- 1 | appwrite messaging updateVonageProvider \ 2 | --providerId \ 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/migrations/create-appwrite-migration.md: -------------------------------------------------------------------------------- 1 | appwrite migrations createAppwriteMigration \ 2 | --resources one two three \ 3 | --endpoint https://example.com \ 4 | --projectId \ 5 | --apiKey 6 | -------------------------------------------------------------------------------- /docs/examples/migrations/create-csv-migration.md: -------------------------------------------------------------------------------- 1 | appwrite migrations createCsvMigration \ 2 | --bucketId \ 3 | --fileId \ 4 | --resourceId [ID1:ID2] 5 | -------------------------------------------------------------------------------- /docs/examples/migrations/create-firebase-migration.md: -------------------------------------------------------------------------------- 1 | appwrite migrations createFirebaseMigration \ 2 | --resources one two three \ 3 | --serviceAccount 4 | -------------------------------------------------------------------------------- /docs/examples/migrations/create-n-host-migration.md: -------------------------------------------------------------------------------- 1 | appwrite migrations createNHostMigration \ 2 | --resources one two three \ 3 | --subdomain \ 4 | --region \ 5 | --adminSecret \ 6 | --database \ 7 | --username \ 8 | --password \ 9 | 10 | -------------------------------------------------------------------------------- /docs/examples/migrations/create-supabase-migration.md: -------------------------------------------------------------------------------- 1 | appwrite migrations createSupabaseMigration \ 2 | --resources one two three \ 3 | --endpoint https://example.com \ 4 | --apiKey \ 5 | --databaseHost \ 6 | --username \ 7 | --password \ 8 | 9 | -------------------------------------------------------------------------------- /docs/examples/migrations/delete.md: -------------------------------------------------------------------------------- 1 | appwrite migrations delete \ 2 | --migrationId 3 | -------------------------------------------------------------------------------- /docs/examples/migrations/get-appwrite-report.md: -------------------------------------------------------------------------------- 1 | appwrite migrations getAppwriteReport \ 2 | --resources one two three \ 3 | --endpoint https://example.com \ 4 | --projectID \ 5 | --key 6 | -------------------------------------------------------------------------------- /docs/examples/migrations/get-firebase-report.md: -------------------------------------------------------------------------------- 1 | appwrite migrations getFirebaseReport \ 2 | --resources one two three \ 3 | --serviceAccount 4 | -------------------------------------------------------------------------------- /docs/examples/migrations/get-n-host-report.md: -------------------------------------------------------------------------------- 1 | appwrite migrations getNHostReport \ 2 | --resources one two three \ 3 | --subdomain \ 4 | --region \ 5 | --adminSecret \ 6 | --database \ 7 | --username \ 8 | --password \ 9 | 10 | -------------------------------------------------------------------------------- /docs/examples/migrations/get-supabase-report.md: -------------------------------------------------------------------------------- 1 | appwrite migrations getSupabaseReport \ 2 | --resources one two three \ 3 | --endpoint https://example.com \ 4 | --apiKey \ 5 | --databaseHost \ 6 | --username \ 7 | --password \ 8 | 9 | -------------------------------------------------------------------------------- /docs/examples/migrations/get.md: -------------------------------------------------------------------------------- 1 | appwrite migrations get \ 2 | --migrationId 3 | -------------------------------------------------------------------------------- /docs/examples/migrations/list.md: -------------------------------------------------------------------------------- 1 | appwrite migrations list \ 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/migrations/retry.md: -------------------------------------------------------------------------------- 1 | appwrite migrations retry \ 2 | --migrationId 3 | -------------------------------------------------------------------------------- /docs/examples/project/create-variable.md: -------------------------------------------------------------------------------- 1 | appwrite project createVariable \ 2 | --key \ 3 | --value \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/project/delete-variable.md: -------------------------------------------------------------------------------- 1 | appwrite project deleteVariable \ 2 | --variableId 3 | -------------------------------------------------------------------------------- /docs/examples/project/get-usage.md: -------------------------------------------------------------------------------- 1 | appwrite project getUsage \ 2 | --startDate '' \ 3 | --endDate '' \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/project/get-variable.md: -------------------------------------------------------------------------------- 1 | appwrite project getVariable \ 2 | --variableId 3 | -------------------------------------------------------------------------------- /docs/examples/project/list-variables.md: -------------------------------------------------------------------------------- 1 | appwrite project listVariables 2 | -------------------------------------------------------------------------------- /docs/examples/project/update-variable.md: -------------------------------------------------------------------------------- 1 | appwrite project updateVariable \ 2 | --variableId \ 3 | --key \ 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/projects/create-dev-key.md: -------------------------------------------------------------------------------- 1 | appwrite projects createDevKey \ 2 | --projectId \ 3 | --name \ 4 | --expire '' 5 | -------------------------------------------------------------------------------- /docs/examples/projects/create-j-w-t.md: -------------------------------------------------------------------------------- 1 | appwrite projects createJWT \ 2 | --projectId \ 3 | --scopes one two three \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/projects/create-key.md: -------------------------------------------------------------------------------- 1 | appwrite projects createKey \ 2 | --projectId \ 3 | --name \ 4 | --scopes one two three \ 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/projects/create-platform.md: -------------------------------------------------------------------------------- 1 | appwrite projects createPlatform \ 2 | --projectId \ 3 | --type web \ 4 | --name \ 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/projects/create-smtp-test.md: -------------------------------------------------------------------------------- 1 | appwrite projects createSmtpTest \ 2 | --projectId \ 3 | --emails one two three \ 4 | --senderName \ 5 | --senderEmail email@example.com \ 6 | --host '' \ 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/examples/projects/create-webhook.md: -------------------------------------------------------------------------------- 1 | appwrite projects createWebhook \ 2 | --projectId \ 3 | --name \ 4 | --events one two three \ 5 | --url '' \ 6 | --security false \ 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/examples/projects/create.md: -------------------------------------------------------------------------------- 1 | appwrite projects create \ 2 | --projectId '' \ 3 | --name \ 4 | --teamId \ 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /docs/examples/projects/delete-dev-key.md: -------------------------------------------------------------------------------- 1 | appwrite projects deleteDevKey \ 2 | --projectId \ 3 | --keyId 4 | -------------------------------------------------------------------------------- /docs/examples/projects/delete-email-template.md: -------------------------------------------------------------------------------- 1 | appwrite projects deleteEmailTemplate \ 2 | --projectId \ 3 | --type verification \ 4 | --locale af 5 | -------------------------------------------------------------------------------- /docs/examples/projects/delete-key.md: -------------------------------------------------------------------------------- 1 | appwrite projects deleteKey \ 2 | --projectId \ 3 | --keyId 4 | -------------------------------------------------------------------------------- /docs/examples/projects/delete-platform.md: -------------------------------------------------------------------------------- 1 | appwrite projects deletePlatform \ 2 | --projectId \ 3 | --platformId 4 | -------------------------------------------------------------------------------- /docs/examples/projects/delete-sms-template.md: -------------------------------------------------------------------------------- 1 | appwrite projects deleteSmsTemplate \ 2 | --projectId \ 3 | --type verification \ 4 | --locale af 5 | -------------------------------------------------------------------------------- /docs/examples/projects/delete-webhook.md: -------------------------------------------------------------------------------- 1 | appwrite projects deleteWebhook \ 2 | --projectId \ 3 | --webhookId 4 | -------------------------------------------------------------------------------- /docs/examples/projects/delete.md: -------------------------------------------------------------------------------- 1 | appwrite projects delete \ 2 | --projectId 3 | -------------------------------------------------------------------------------- /docs/examples/projects/get-dev-key.md: -------------------------------------------------------------------------------- 1 | appwrite projects getDevKey \ 2 | --projectId \ 3 | --keyId 4 | -------------------------------------------------------------------------------- /docs/examples/projects/get-email-template.md: -------------------------------------------------------------------------------- 1 | appwrite projects getEmailTemplate \ 2 | --projectId \ 3 | --type verification \ 4 | --locale af 5 | -------------------------------------------------------------------------------- /docs/examples/projects/get-key.md: -------------------------------------------------------------------------------- 1 | appwrite projects getKey \ 2 | --projectId \ 3 | --keyId 4 | -------------------------------------------------------------------------------- /docs/examples/projects/get-platform.md: -------------------------------------------------------------------------------- 1 | appwrite projects getPlatform \ 2 | --projectId \ 3 | --platformId 4 | -------------------------------------------------------------------------------- /docs/examples/projects/get-sms-template.md: -------------------------------------------------------------------------------- 1 | appwrite projects getSmsTemplate \ 2 | --projectId \ 3 | --type verification \ 4 | --locale af 5 | -------------------------------------------------------------------------------- /docs/examples/projects/get-webhook.md: -------------------------------------------------------------------------------- 1 | appwrite projects getWebhook \ 2 | --projectId \ 3 | --webhookId 4 | -------------------------------------------------------------------------------- /docs/examples/projects/get.md: -------------------------------------------------------------------------------- 1 | appwrite projects get \ 2 | --projectId 3 | -------------------------------------------------------------------------------- /docs/examples/projects/list-dev-keys.md: -------------------------------------------------------------------------------- 1 | appwrite projects listDevKeys \ 2 | --projectId \ 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/projects/list-keys.md: -------------------------------------------------------------------------------- 1 | appwrite projects listKeys \ 2 | --projectId 3 | -------------------------------------------------------------------------------- /docs/examples/projects/list-platforms.md: -------------------------------------------------------------------------------- 1 | appwrite projects listPlatforms \ 2 | --projectId 3 | -------------------------------------------------------------------------------- /docs/examples/projects/list-webhooks.md: -------------------------------------------------------------------------------- 1 | appwrite projects listWebhooks \ 2 | --projectId 3 | -------------------------------------------------------------------------------- /docs/examples/projects/list.md: -------------------------------------------------------------------------------- 1 | appwrite projects list \ 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/projects/update-api-status-all.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateApiStatusAll \ 2 | --projectId \ 3 | --status false 4 | -------------------------------------------------------------------------------- /docs/examples/projects/update-api-status.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateApiStatus \ 2 | --projectId \ 3 | --api rest \ 4 | --status false 5 | -------------------------------------------------------------------------------- /docs/examples/projects/update-auth-duration.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateAuthDuration \ 2 | --projectId \ 3 | --duration 0 4 | -------------------------------------------------------------------------------- /docs/examples/projects/update-auth-limit.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateAuthLimit \ 2 | --projectId \ 3 | --limit 0 4 | -------------------------------------------------------------------------------- /docs/examples/projects/update-auth-password-dictionary.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateAuthPasswordDictionary \ 2 | --projectId \ 3 | --enabled false 4 | -------------------------------------------------------------------------------- /docs/examples/projects/update-auth-password-history.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateAuthPasswordHistory \ 2 | --projectId \ 3 | --limit 0 4 | -------------------------------------------------------------------------------- /docs/examples/projects/update-auth-sessions-limit.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateAuthSessionsLimit \ 2 | --projectId \ 3 | --limit 1 4 | -------------------------------------------------------------------------------- /docs/examples/projects/update-auth-status.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateAuthStatus \ 2 | --projectId \ 3 | --method email-password \ 4 | --status false 5 | -------------------------------------------------------------------------------- /docs/examples/projects/update-dev-key.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateDevKey \ 2 | --projectId \ 3 | --keyId \ 4 | --name \ 5 | --expire '' 6 | -------------------------------------------------------------------------------- /docs/examples/projects/update-email-template.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateEmailTemplate \ 2 | --projectId \ 3 | --type verification \ 4 | --locale af \ 5 | --subject \ 6 | --message \ 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/examples/projects/update-key.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateKey \ 2 | --projectId \ 3 | --keyId \ 4 | --name \ 5 | --scopes one two three \ 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/projects/update-memberships-privacy.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateMembershipsPrivacy \ 2 | --projectId \ 3 | --userName false \ 4 | --userEmail false \ 5 | --mfa false 6 | -------------------------------------------------------------------------------- /docs/examples/projects/update-mock-numbers.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateMockNumbers \ 2 | --projectId \ 3 | --numbers one two three 4 | -------------------------------------------------------------------------------- /docs/examples/projects/update-o-auth2.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateOAuth2 \ 2 | --projectId \ 3 | --provider amazon \ 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/projects/update-personal-data-check.md: -------------------------------------------------------------------------------- 1 | appwrite projects updatePersonalDataCheck \ 2 | --projectId \ 3 | --enabled false 4 | -------------------------------------------------------------------------------- /docs/examples/projects/update-platform.md: -------------------------------------------------------------------------------- 1 | appwrite projects updatePlatform \ 2 | --projectId \ 3 | --platformId \ 4 | --name \ 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/projects/update-service-status-all.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateServiceStatusAll \ 2 | --projectId \ 3 | --status false 4 | -------------------------------------------------------------------------------- /docs/examples/projects/update-service-status.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateServiceStatus \ 2 | --projectId \ 3 | --service account \ 4 | --status false 5 | -------------------------------------------------------------------------------- /docs/examples/projects/update-session-alerts.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateSessionAlerts \ 2 | --projectId \ 3 | --alerts false 4 | -------------------------------------------------------------------------------- /docs/examples/projects/update-sms-template.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateSmsTemplate \ 2 | --projectId \ 3 | --type verification \ 4 | --locale af \ 5 | --message 6 | -------------------------------------------------------------------------------- /docs/examples/projects/update-smtp.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateSmtp \ 2 | --projectId \ 3 | --enabled false \ 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/examples/projects/update-team.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateTeam \ 2 | --projectId \ 3 | --teamId 4 | -------------------------------------------------------------------------------- /docs/examples/projects/update-webhook-signature.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateWebhookSignature \ 2 | --projectId \ 3 | --webhookId 4 | -------------------------------------------------------------------------------- /docs/examples/projects/update-webhook.md: -------------------------------------------------------------------------------- 1 | appwrite projects updateWebhook \ 2 | --projectId \ 3 | --webhookId \ 4 | --name \ 5 | --events one two three \ 6 | --url '' \ 7 | --security false \ 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/examples/projects/update.md: -------------------------------------------------------------------------------- 1 | appwrite projects update \ 2 | --projectId \ 3 | --name \ 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/examples/proxy/create-a-p-i-rule.md: -------------------------------------------------------------------------------- 1 | appwrite proxy createAPIRule \ 2 | --domain '' 3 | -------------------------------------------------------------------------------- /docs/examples/proxy/create-function-rule.md: -------------------------------------------------------------------------------- 1 | appwrite proxy createFunctionRule \ 2 | --domain '' \ 3 | --functionId \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/proxy/create-redirect-rule.md: -------------------------------------------------------------------------------- 1 | appwrite proxy createRedirectRule \ 2 | --domain '' \ 3 | --url https://example.com \ 4 | --statusCode 301 5 | -------------------------------------------------------------------------------- /docs/examples/proxy/create-site-rule.md: -------------------------------------------------------------------------------- 1 | appwrite proxy createSiteRule \ 2 | --domain '' \ 3 | --siteId \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/proxy/delete-rule.md: -------------------------------------------------------------------------------- 1 | appwrite proxy deleteRule \ 2 | --ruleId 3 | -------------------------------------------------------------------------------- /docs/examples/proxy/get-rule.md: -------------------------------------------------------------------------------- 1 | appwrite proxy getRule \ 2 | --ruleId 3 | -------------------------------------------------------------------------------- /docs/examples/proxy/list-rules.md: -------------------------------------------------------------------------------- 1 | appwrite proxy listRules \ 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/proxy/update-rule-verification.md: -------------------------------------------------------------------------------- 1 | appwrite proxy updateRuleVerification \ 2 | --ruleId 3 | -------------------------------------------------------------------------------- /docs/examples/sites/create-deployment.md: -------------------------------------------------------------------------------- 1 | appwrite sites createDeployment \ 2 | --siteId \ 3 | --code 'path/to/file.png' \ 4 | --activate false \ 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/sites/create-duplicate-deployment.md: -------------------------------------------------------------------------------- 1 | appwrite sites createDuplicateDeployment \ 2 | --siteId \ 3 | --deploymentId 4 | -------------------------------------------------------------------------------- /docs/examples/sites/create-template-deployment.md: -------------------------------------------------------------------------------- 1 | appwrite sites createTemplateDeployment \ 2 | --siteId \ 3 | --repository \ 4 | --owner \ 5 | --rootDirectory \ 6 | --version \ 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/sites/create-variable.md: -------------------------------------------------------------------------------- 1 | appwrite sites createVariable \ 2 | --siteId \ 3 | --key \ 4 | --value \ 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/sites/create-vcs-deployment.md: -------------------------------------------------------------------------------- 1 | appwrite sites createVcsDeployment \ 2 | --siteId \ 3 | --type branch \ 4 | --reference \ 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/sites/create.md: -------------------------------------------------------------------------------- 1 | appwrite sites create \ 2 | --siteId \ 3 | --name \ 4 | --framework analog \ 5 | --buildRuntime node-14.5 \ 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/examples/sites/delete-deployment.md: -------------------------------------------------------------------------------- 1 | appwrite sites deleteDeployment \ 2 | --siteId \ 3 | --deploymentId 4 | -------------------------------------------------------------------------------- /docs/examples/sites/delete-log.md: -------------------------------------------------------------------------------- 1 | appwrite sites deleteLog \ 2 | --siteId \ 3 | --logId 4 | -------------------------------------------------------------------------------- /docs/examples/sites/delete-variable.md: -------------------------------------------------------------------------------- 1 | appwrite sites deleteVariable \ 2 | --siteId \ 3 | --variableId 4 | -------------------------------------------------------------------------------- /docs/examples/sites/delete.md: -------------------------------------------------------------------------------- 1 | appwrite sites delete \ 2 | --siteId 3 | -------------------------------------------------------------------------------- /docs/examples/sites/get-deployment-download.md: -------------------------------------------------------------------------------- 1 | appwrite sites getDeploymentDownload \ 2 | --siteId \ 3 | --deploymentId \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/sites/get-deployment.md: -------------------------------------------------------------------------------- 1 | appwrite sites getDeployment \ 2 | --siteId \ 3 | --deploymentId 4 | -------------------------------------------------------------------------------- /docs/examples/sites/get-log.md: -------------------------------------------------------------------------------- 1 | appwrite sites getLog \ 2 | --siteId \ 3 | --logId 4 | -------------------------------------------------------------------------------- /docs/examples/sites/get-template.md: -------------------------------------------------------------------------------- 1 | appwrite sites getTemplate \ 2 | --templateId 3 | -------------------------------------------------------------------------------- /docs/examples/sites/get-usage.md: -------------------------------------------------------------------------------- 1 | appwrite sites getUsage \ 2 | --siteId \ 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/sites/get-variable.md: -------------------------------------------------------------------------------- 1 | appwrite sites getVariable \ 2 | --siteId \ 3 | --variableId 4 | -------------------------------------------------------------------------------- /docs/examples/sites/get.md: -------------------------------------------------------------------------------- 1 | appwrite sites get \ 2 | --siteId 3 | -------------------------------------------------------------------------------- /docs/examples/sites/list-deployments.md: -------------------------------------------------------------------------------- 1 | appwrite sites listDeployments \ 2 | --siteId \ 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/sites/list-frameworks.md: -------------------------------------------------------------------------------- 1 | appwrite sites listFrameworks 2 | -------------------------------------------------------------------------------- /docs/examples/sites/list-logs.md: -------------------------------------------------------------------------------- 1 | appwrite sites listLogs \ 2 | --siteId \ 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/sites/list-specifications.md: -------------------------------------------------------------------------------- 1 | appwrite sites listSpecifications 2 | -------------------------------------------------------------------------------- /docs/examples/sites/list-templates.md: -------------------------------------------------------------------------------- 1 | appwrite sites listTemplates \ 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/sites/list-usage.md: -------------------------------------------------------------------------------- 1 | appwrite sites listUsage \ 2 | 3 | -------------------------------------------------------------------------------- /docs/examples/sites/list-variables.md: -------------------------------------------------------------------------------- 1 | appwrite sites listVariables \ 2 | --siteId 3 | -------------------------------------------------------------------------------- /docs/examples/sites/list.md: -------------------------------------------------------------------------------- 1 | appwrite sites list \ 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/sites/update-deployment-status.md: -------------------------------------------------------------------------------- 1 | appwrite sites updateDeploymentStatus \ 2 | --siteId \ 3 | --deploymentId 4 | -------------------------------------------------------------------------------- /docs/examples/sites/update-site-deployment.md: -------------------------------------------------------------------------------- 1 | appwrite sites updateSiteDeployment \ 2 | --siteId \ 3 | --deploymentId 4 | -------------------------------------------------------------------------------- /docs/examples/sites/update-variable.md: -------------------------------------------------------------------------------- 1 | appwrite sites updateVariable \ 2 | --siteId \ 3 | --variableId \ 4 | --key \ 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/sites/update.md: -------------------------------------------------------------------------------- 1 | appwrite sites update \ 2 | --siteId \ 3 | --name \ 4 | --framework analog \ 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/examples/storage/create-bucket.md: -------------------------------------------------------------------------------- 1 | appwrite storage createBucket \ 2 | --bucketId \ 3 | --name \ 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/examples/storage/create-file.md: -------------------------------------------------------------------------------- 1 | appwrite storage createFile \ 2 | --bucketId \ 3 | --fileId \ 4 | --file 'path/to/file.png' \ 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/storage/delete-bucket.md: -------------------------------------------------------------------------------- 1 | appwrite storage deleteBucket \ 2 | --bucketId 3 | -------------------------------------------------------------------------------- /docs/examples/storage/delete-file.md: -------------------------------------------------------------------------------- 1 | appwrite storage deleteFile \ 2 | --bucketId \ 3 | --fileId 4 | -------------------------------------------------------------------------------- /docs/examples/storage/get-bucket-usage.md: -------------------------------------------------------------------------------- 1 | appwrite storage getBucketUsage \ 2 | --bucketId \ 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/storage/get-bucket.md: -------------------------------------------------------------------------------- 1 | appwrite storage getBucket \ 2 | --bucketId 3 | -------------------------------------------------------------------------------- /docs/examples/storage/get-file-download.md: -------------------------------------------------------------------------------- 1 | appwrite storage getFileDownload \ 2 | --bucketId \ 3 | --fileId \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/storage/get-file-preview.md: -------------------------------------------------------------------------------- 1 | appwrite storage getFilePreview \ 2 | --bucketId \ 3 | --fileId \ 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/examples/storage/get-file-view.md: -------------------------------------------------------------------------------- 1 | appwrite storage getFileView \ 2 | --bucketId \ 3 | --fileId \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/storage/get-file.md: -------------------------------------------------------------------------------- 1 | appwrite storage getFile \ 2 | --bucketId \ 3 | --fileId 4 | -------------------------------------------------------------------------------- /docs/examples/storage/get-usage.md: -------------------------------------------------------------------------------- 1 | appwrite storage getUsage \ 2 | 3 | -------------------------------------------------------------------------------- /docs/examples/storage/list-buckets.md: -------------------------------------------------------------------------------- 1 | appwrite storage listBuckets \ 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/storage/list-files.md: -------------------------------------------------------------------------------- 1 | appwrite storage listFiles \ 2 | --bucketId \ 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/storage/update-bucket.md: -------------------------------------------------------------------------------- 1 | appwrite storage updateBucket \ 2 | --bucketId \ 3 | --name \ 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/examples/storage/update-file.md: -------------------------------------------------------------------------------- 1 | appwrite storage updateFile \ 2 | --bucketId \ 3 | --fileId \ 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/teams/create-membership.md: -------------------------------------------------------------------------------- 1 | appwrite teams createMembership \ 2 | --teamId \ 3 | --roles one two three \ 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/examples/teams/create.md: -------------------------------------------------------------------------------- 1 | appwrite teams create \ 2 | --teamId \ 3 | --name \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/teams/delete-membership.md: -------------------------------------------------------------------------------- 1 | appwrite teams deleteMembership \ 2 | --teamId \ 3 | --membershipId 4 | -------------------------------------------------------------------------------- /docs/examples/teams/delete.md: -------------------------------------------------------------------------------- 1 | appwrite teams delete \ 2 | --teamId 3 | -------------------------------------------------------------------------------- /docs/examples/teams/get-membership.md: -------------------------------------------------------------------------------- 1 | appwrite teams getMembership \ 2 | --teamId \ 3 | --membershipId 4 | -------------------------------------------------------------------------------- /docs/examples/teams/get-prefs.md: -------------------------------------------------------------------------------- 1 | appwrite teams getPrefs \ 2 | --teamId 3 | -------------------------------------------------------------------------------- /docs/examples/teams/get.md: -------------------------------------------------------------------------------- 1 | appwrite teams get \ 2 | --teamId 3 | -------------------------------------------------------------------------------- /docs/examples/teams/list-logs.md: -------------------------------------------------------------------------------- 1 | appwrite teams listLogs \ 2 | --teamId \ 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/teams/list-memberships.md: -------------------------------------------------------------------------------- 1 | appwrite teams listMemberships \ 2 | --teamId \ 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/teams/list.md: -------------------------------------------------------------------------------- 1 | appwrite teams list \ 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/teams/update-membership-status.md: -------------------------------------------------------------------------------- 1 | appwrite teams updateMembershipStatus \ 2 | --teamId \ 3 | --membershipId \ 4 | --userId \ 5 | --secret 6 | -------------------------------------------------------------------------------- /docs/examples/teams/update-membership.md: -------------------------------------------------------------------------------- 1 | appwrite teams updateMembership \ 2 | --teamId \ 3 | --membershipId \ 4 | --roles one two three 5 | -------------------------------------------------------------------------------- /docs/examples/teams/update-name.md: -------------------------------------------------------------------------------- 1 | appwrite teams updateName \ 2 | --teamId \ 3 | --name 4 | -------------------------------------------------------------------------------- /docs/examples/teams/update-prefs.md: -------------------------------------------------------------------------------- 1 | appwrite teams updatePrefs \ 2 | --teamId \ 3 | --prefs '{ "key": "value" }' 4 | -------------------------------------------------------------------------------- /docs/examples/tokens/create-file-token.md: -------------------------------------------------------------------------------- 1 | appwrite tokens createFileToken \ 2 | --bucketId \ 3 | --fileId \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/tokens/delete.md: -------------------------------------------------------------------------------- 1 | appwrite tokens delete \ 2 | --tokenId 3 | -------------------------------------------------------------------------------- /docs/examples/tokens/get.md: -------------------------------------------------------------------------------- 1 | appwrite tokens get \ 2 | --tokenId 3 | -------------------------------------------------------------------------------- /docs/examples/tokens/list.md: -------------------------------------------------------------------------------- 1 | appwrite tokens list \ 2 | --bucketId \ 3 | --fileId \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/tokens/update.md: -------------------------------------------------------------------------------- 1 | appwrite tokens update \ 2 | --tokenId \ 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/users/create-argon2user.md: -------------------------------------------------------------------------------- 1 | appwrite users createArgon2User \ 2 | --userId \ 3 | --email email@example.com \ 4 | --password password \ 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/users/create-bcrypt-user.md: -------------------------------------------------------------------------------- 1 | appwrite users createBcryptUser \ 2 | --userId \ 3 | --email email@example.com \ 4 | --password password \ 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/users/create-j-w-t.md: -------------------------------------------------------------------------------- 1 | appwrite users createJWT \ 2 | --userId \ 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/users/create-m-d5user.md: -------------------------------------------------------------------------------- 1 | appwrite users createMD5User \ 2 | --userId \ 3 | --email email@example.com \ 4 | --password password \ 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/users/create-mfa-recovery-codes.md: -------------------------------------------------------------------------------- 1 | appwrite users createMfaRecoveryCodes \ 2 | --userId 3 | -------------------------------------------------------------------------------- /docs/examples/users/create-p-h-pass-user.md: -------------------------------------------------------------------------------- 1 | appwrite users createPHPassUser \ 2 | --userId \ 3 | --email email@example.com \ 4 | --password password \ 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/users/create-s-h-a-user.md: -------------------------------------------------------------------------------- 1 | appwrite users createSHAUser \ 2 | --userId \ 3 | --email email@example.com \ 4 | --password password \ 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/users/create-scrypt-modified-user.md: -------------------------------------------------------------------------------- 1 | appwrite users createScryptModifiedUser \ 2 | --userId \ 3 | --email email@example.com \ 4 | --password password \ 5 | --passwordSalt \ 6 | --passwordSaltSeparator \ 7 | --passwordSignerKey \ 8 | 9 | -------------------------------------------------------------------------------- /docs/examples/users/create-scrypt-user.md: -------------------------------------------------------------------------------- 1 | appwrite users createScryptUser \ 2 | --userId \ 3 | --email email@example.com \ 4 | --password password \ 5 | --passwordSalt \ 6 | --passwordCpu null \ 7 | --passwordMemory null \ 8 | --passwordParallel null \ 9 | --passwordLength null \ 10 | 11 | -------------------------------------------------------------------------------- /docs/examples/users/create-session.md: -------------------------------------------------------------------------------- 1 | appwrite users createSession \ 2 | --userId 3 | -------------------------------------------------------------------------------- /docs/examples/users/create-target.md: -------------------------------------------------------------------------------- 1 | appwrite users createTarget \ 2 | --userId \ 3 | --targetId \ 4 | --providerType email \ 5 | --identifier \ 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/examples/users/create-token.md: -------------------------------------------------------------------------------- 1 | appwrite users createToken \ 2 | --userId \ 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/users/create.md: -------------------------------------------------------------------------------- 1 | appwrite users create \ 2 | --userId \ 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/users/delete-identity.md: -------------------------------------------------------------------------------- 1 | appwrite users deleteIdentity \ 2 | --identityId 3 | -------------------------------------------------------------------------------- /docs/examples/users/delete-mfa-authenticator.md: -------------------------------------------------------------------------------- 1 | appwrite users deleteMfaAuthenticator \ 2 | --userId \ 3 | --type totp 4 | -------------------------------------------------------------------------------- /docs/examples/users/delete-session.md: -------------------------------------------------------------------------------- 1 | appwrite users deleteSession \ 2 | --userId \ 3 | --sessionId 4 | -------------------------------------------------------------------------------- /docs/examples/users/delete-sessions.md: -------------------------------------------------------------------------------- 1 | appwrite users deleteSessions \ 2 | --userId 3 | -------------------------------------------------------------------------------- /docs/examples/users/delete-target.md: -------------------------------------------------------------------------------- 1 | appwrite users deleteTarget \ 2 | --userId \ 3 | --targetId 4 | -------------------------------------------------------------------------------- /docs/examples/users/delete.md: -------------------------------------------------------------------------------- 1 | appwrite users delete \ 2 | --userId 3 | -------------------------------------------------------------------------------- /docs/examples/users/get-mfa-recovery-codes.md: -------------------------------------------------------------------------------- 1 | appwrite users getMfaRecoveryCodes \ 2 | --userId 3 | -------------------------------------------------------------------------------- /docs/examples/users/get-prefs.md: -------------------------------------------------------------------------------- 1 | appwrite users getPrefs \ 2 | --userId 3 | -------------------------------------------------------------------------------- /docs/examples/users/get-target.md: -------------------------------------------------------------------------------- 1 | appwrite users getTarget \ 2 | --userId \ 3 | --targetId 4 | -------------------------------------------------------------------------------- /docs/examples/users/get-usage.md: -------------------------------------------------------------------------------- 1 | appwrite users getUsage \ 2 | 3 | -------------------------------------------------------------------------------- /docs/examples/users/get.md: -------------------------------------------------------------------------------- 1 | appwrite users get \ 2 | --userId 3 | -------------------------------------------------------------------------------- /docs/examples/users/list-identities.md: -------------------------------------------------------------------------------- 1 | appwrite users listIdentities \ 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/users/list-logs.md: -------------------------------------------------------------------------------- 1 | appwrite users listLogs \ 2 | --userId \ 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/users/list-memberships.md: -------------------------------------------------------------------------------- 1 | appwrite users listMemberships \ 2 | --userId \ 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/users/list-mfa-factors.md: -------------------------------------------------------------------------------- 1 | appwrite users listMfaFactors \ 2 | --userId 3 | -------------------------------------------------------------------------------- /docs/examples/users/list-sessions.md: -------------------------------------------------------------------------------- 1 | appwrite users listSessions \ 2 | --userId 3 | -------------------------------------------------------------------------------- /docs/examples/users/list-targets.md: -------------------------------------------------------------------------------- 1 | appwrite users listTargets \ 2 | --userId \ 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/users/list.md: -------------------------------------------------------------------------------- 1 | appwrite users list \ 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/users/update-email-verification.md: -------------------------------------------------------------------------------- 1 | appwrite users updateEmailVerification \ 2 | --userId \ 3 | --emailVerification false 4 | -------------------------------------------------------------------------------- /docs/examples/users/update-email.md: -------------------------------------------------------------------------------- 1 | appwrite users updateEmail \ 2 | --userId \ 3 | --email email@example.com 4 | -------------------------------------------------------------------------------- /docs/examples/users/update-labels.md: -------------------------------------------------------------------------------- 1 | appwrite users updateLabels \ 2 | --userId \ 3 | --labels one two three 4 | -------------------------------------------------------------------------------- /docs/examples/users/update-mfa-recovery-codes.md: -------------------------------------------------------------------------------- 1 | appwrite users updateMfaRecoveryCodes \ 2 | --userId 3 | -------------------------------------------------------------------------------- /docs/examples/users/update-mfa.md: -------------------------------------------------------------------------------- 1 | appwrite users updateMfa \ 2 | --userId \ 3 | --mfa false 4 | -------------------------------------------------------------------------------- /docs/examples/users/update-name.md: -------------------------------------------------------------------------------- 1 | appwrite users updateName \ 2 | --userId \ 3 | --name 4 | -------------------------------------------------------------------------------- /docs/examples/users/update-password.md: -------------------------------------------------------------------------------- 1 | appwrite users updatePassword \ 2 | --userId \ 3 | --password '' 4 | -------------------------------------------------------------------------------- /docs/examples/users/update-phone-verification.md: -------------------------------------------------------------------------------- 1 | appwrite users updatePhoneVerification \ 2 | --userId \ 3 | --phoneVerification false 4 | -------------------------------------------------------------------------------- /docs/examples/users/update-phone.md: -------------------------------------------------------------------------------- 1 | appwrite users updatePhone \ 2 | --userId \ 3 | --number +12065550100 4 | -------------------------------------------------------------------------------- /docs/examples/users/update-prefs.md: -------------------------------------------------------------------------------- 1 | appwrite users updatePrefs \ 2 | --userId \ 3 | --prefs '{ "key": "value" }' 4 | -------------------------------------------------------------------------------- /docs/examples/users/update-status.md: -------------------------------------------------------------------------------- 1 | appwrite users updateStatus \ 2 | --userId \ 3 | --status false 4 | -------------------------------------------------------------------------------- /docs/examples/users/update-target.md: -------------------------------------------------------------------------------- 1 | appwrite users updateTarget \ 2 | --userId \ 3 | --targetId \ 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/examples/vcs/create-repository-detection.md: -------------------------------------------------------------------------------- 1 | appwrite vcs createRepositoryDetection \ 2 | --installationId \ 3 | --providerRepositoryId \ 4 | --type runtime \ 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/vcs/create-repository.md: -------------------------------------------------------------------------------- 1 | appwrite vcs createRepository \ 2 | --installationId \ 3 | --name \ 4 | --private false 5 | -------------------------------------------------------------------------------- /docs/examples/vcs/delete-installation.md: -------------------------------------------------------------------------------- 1 | appwrite vcs deleteInstallation \ 2 | --installationId 3 | -------------------------------------------------------------------------------- /docs/examples/vcs/get-installation.md: -------------------------------------------------------------------------------- 1 | appwrite vcs getInstallation \ 2 | --installationId 3 | -------------------------------------------------------------------------------- /docs/examples/vcs/get-repository-contents.md: -------------------------------------------------------------------------------- 1 | appwrite vcs getRepositoryContents \ 2 | --installationId \ 3 | --providerRepositoryId \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/vcs/get-repository.md: -------------------------------------------------------------------------------- 1 | appwrite vcs getRepository \ 2 | --installationId \ 3 | --providerRepositoryId 4 | -------------------------------------------------------------------------------- /docs/examples/vcs/list-installations.md: -------------------------------------------------------------------------------- 1 | appwrite vcs listInstallations \ 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/examples/vcs/list-repositories.md: -------------------------------------------------------------------------------- 1 | appwrite vcs listRepositories \ 2 | --installationId \ 3 | --type runtime \ 4 | 5 | -------------------------------------------------------------------------------- /docs/examples/vcs/list-repository-branches.md: -------------------------------------------------------------------------------- 1 | appwrite vcs listRepositoryBranches \ 2 | --installationId \ 3 | --providerRepositoryId 4 | -------------------------------------------------------------------------------- /docs/examples/vcs/update-external-deployments.md: -------------------------------------------------------------------------------- 1 | appwrite vcs updateExternalDeployments \ 2 | --installationId \ 3 | --repositoryId \ 4 | --providerPullRequestId 5 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | /** Required to set max width of the help commands */ 4 | const oldWidth = process.stdout.columns 5 | process.stdout.columns = 100 6 | /** ---------------------------------------------- */ 7 | 8 | const program = require("commander"); 9 | const chalk = require("chalk"); 10 | const { version } = require("./package.json"); 11 | const { commandDescriptions, cliConfig } = require("./lib/parser"); 12 | const { client } = require("./lib/commands/generic"); 13 | const inquirer = require("inquirer"); 14 | const { login, logout, whoami, migrate, register } = require("./lib/commands/generic"); 15 | const { init } = require("./lib/commands/init"); 16 | const { pull } = require("./lib/commands/pull"); 17 | const { run } = require("./lib/commands/run"); 18 | const { push, deploy } = require("./lib/commands/push"); 19 | const { account } = require("./lib/commands/account"); 20 | const { avatars } = require("./lib/commands/avatars"); 21 | const { assistant } = require("./lib/commands/assistant"); 22 | const { console } = require("./lib/commands/console"); 23 | const { databases } = require("./lib/commands/databases"); 24 | const { functions } = require("./lib/commands/functions"); 25 | const { graphql } = require("./lib/commands/graphql"); 26 | const { health } = require("./lib/commands/health"); 27 | const { locale } = require("./lib/commands/locale"); 28 | const { messaging } = require("./lib/commands/messaging"); 29 | const { migrations } = require("./lib/commands/migrations"); 30 | const { project } = require("./lib/commands/project"); 31 | const { projects } = require("./lib/commands/projects"); 32 | const { proxy } = require("./lib/commands/proxy"); 33 | const { sites } = require("./lib/commands/sites"); 34 | const { storage } = require("./lib/commands/storage"); 35 | const { teams } = require("./lib/commands/teams"); 36 | const { tokens } = require("./lib/commands/tokens"); 37 | const { users } = require("./lib/commands/users"); 38 | const { vcs } = require("./lib/commands/vcs"); 39 | 40 | inquirer.registerPrompt('search-list', require('inquirer-search-list')); 41 | 42 | program 43 | .description(commandDescriptions['main']) 44 | .configureHelp({ 45 | helpWidth: process.stdout.columns || 80, 46 | sortSubcommands: true, 47 | }) 48 | .helpOption('-h, --help', "Display help for command") 49 | .version(version, "-v, --version", "Output the version number") 50 | .option("-V, --verbose", "Show complete error log") 51 | .option("-j, --json", "Output in JSON format") 52 | .hook('preAction', migrate) 53 | .option("-f,--force", "Flag to confirm all warnings") 54 | .option("-a,--all", "Flag to push all resources") 55 | .option("--id [id...]", "Flag to pass a list of ids for a given action") 56 | .option("--report", "Enable reporting in case of CLI errors") 57 | .on("option:json", () => { 58 | cliConfig.json = true; 59 | }) 60 | .on("option:verbose", () => { 61 | cliConfig.verbose = true; 62 | }) 63 | .on("option:report", function() { 64 | cliConfig.report = true; 65 | cliConfig.reportData = { data: this }; 66 | }) 67 | .on("option:force", () => { 68 | cliConfig.force = true; 69 | }) 70 | .on("option:all", () => { 71 | cliConfig.all = true; 72 | }) 73 | .on("option:id", function() { 74 | cliConfig.ids = this.opts().id; 75 | }) 76 | .showSuggestionAfterError() 77 | .addCommand(whoami) 78 | .addCommand(register) 79 | .addCommand(login) 80 | .addCommand(init) 81 | .addCommand(pull) 82 | .addCommand(push) 83 | .addCommand(deploy) 84 | .addCommand(run) 85 | .addCommand(logout) 86 | .addCommand(account) 87 | .addCommand(avatars) 88 | .addCommand(assistant) 89 | .addCommand(console) 90 | .addCommand(databases) 91 | .addCommand(functions) 92 | .addCommand(graphql) 93 | .addCommand(health) 94 | .addCommand(locale) 95 | .addCommand(messaging) 96 | .addCommand(migrations) 97 | .addCommand(project) 98 | .addCommand(projects) 99 | .addCommand(proxy) 100 | .addCommand(sites) 101 | .addCommand(storage) 102 | .addCommand(teams) 103 | .addCommand(tokens) 104 | .addCommand(users) 105 | .addCommand(vcs) 106 | .addCommand(client) 107 | .parse(process.argv); 108 | 109 | process.stdout.columns = oldWidth; 110 | -------------------------------------------------------------------------------- /install.ps1: -------------------------------------------------------------------------------- 1 | ## 2 | ## 3 | ## 4 | ## 5 | ## 6 | # Love open-source, dev-tooling and passionate about code as much as we do? 7 | # --- 8 | # We're always looking for awesome hackers like you to join our 100% remote team! 9 | # Check and see if you find any relevant position @ https://appwrite.io/company/careers 👩‍💻 😎 10 | # (and let us know you found this message...) 11 | 12 | # This script contains hidden JS code to allow better readability and syntax highlighting 13 | # You can use "View source" of this page to see the full script. 14 | 15 | # REPO 16 | $GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/7.0.0/appwrite-cli-win-x64.exe" 17 | $GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/7.0.0/appwrite-cli-win-arm64.exe" 18 | 19 | $APPWRITE_BINARY_NAME = "appwrite.exe" 20 | 21 | # Appwrite download directory 22 | $APPWRITE_DOWNLOAD_DIR = Join-Path -Path $env:TEMP -ChildPath $APPWRITE_BINARY_NAME 23 | 24 | # Appwrite CLI location 25 | $APPWRITE_INSTALL_DIR = Join-Path -Path $env:LOCALAPPDATA -ChildPath "Appwrite" 26 | $APPWRITE_INSTALL_PATH = Join-Path -Path "$APPWRITE_INSTALL_DIR" -ChildPath "$APPWRITE_BINARY_NAME" 27 | 28 | $USER_PATH_ENV_VAR = [Environment]::GetEnvironmentVariable("PATH", "User") 29 | 30 | function Greeting { 31 | Write-Host @" 32 | 33 | _ _ _ ___ __ _____ 34 | /_\ _ __ _ ____ ___ __(_) |_ ___ / __\ / / \_ \ 35 | //_\\| '_ \| '_ \ \ /\ / / '__| | __/ _ \ / / / / / /\/ 36 | / _ \ |_) | |_) \ V V /| | | | || __/ / /___/ /___/\/ /_ 37 | \_/ \_/ .__/| .__/ \_/\_/ |_| |_|\__\___| \____/\____/\____/ 38 | |_| |_| 39 | 40 | "@ -ForegroundColor red 41 | Write-Host "Welcome to the Appwrite CLI install shield." 42 | } 43 | 44 | 45 | function CheckSystemInfo { 46 | Write-Host "[1/4] Getting System Info ..." 47 | if ((Get-ExecutionPolicy) -gt 'RemoteSigned' -or (Get-ExecutionPolicy) -eq 'ByPass') { 48 | Write-Host "PowerShell requires an execution policy of 'RemoteSigned'." 49 | Write-Host "To make this change please run:" 50 | Write-Host "'Set-ExecutionPolicy RemoteSigned -scope CurrentUser'" 51 | break 52 | } 53 | } 54 | 55 | function DownloadBinary { 56 | Write-Host "[2/4] Downloading Appwrite CLI binary ..." 57 | Write-Host "🚦 Fetching latest version ... " -ForegroundColor green 58 | 59 | if((Get-CimInstance Win32_operatingsystem).OSArchitecture -like '*ARM*') { 60 | Invoke-WebRequest -Uri $GITHUB_arm64_URL -OutFile $APPWRITE_DOWNLOAD_DIR 61 | } else { 62 | Invoke-WebRequest -Uri $GITHUB_x64_URL -OutFile $APPWRITE_DOWNLOAD_DIR 63 | } 64 | 65 | New-Item -ItemType Directory -Path $APPWRITE_INSTALL_DIR 66 | Move-Item $APPWRITE_DOWNLOAD_DIR $APPWRITE_INSTALL_PATH 67 | } 68 | 69 | 70 | function Install { 71 | Write-Host "[3/4] Starting installation ..." 72 | 73 | if ($USER_PATH_ENV_VAR -like '*Appwrite*') { 74 | Write-Host "Skipping to add Appwrite to User Path." 75 | } else { 76 | [System.Environment]::SetEnvironmentVariable("PATH", $USER_PATH_ENV_VAR + ";$APPWRITE_INSTALL_DIR", "User") 77 | $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") 78 | } 79 | } 80 | 81 | function CleanUp { 82 | Write-Host "Cleaning up mess ..." 83 | } 84 | 85 | function InstallCompleted { 86 | Write-Host "[4/4] Finishing Installation ... " 87 | cleanup 88 | Write-Host "To get started with Appwrite CLI, please visit https://appwrite.io/docs/command-line" 89 | Write-Host "As first step, you can login to your Appwrite account using 'appwrite login'" 90 | } 91 | 92 | 93 | Greeting 94 | CheckSystemInfo 95 | DownloadBinary 96 | Install 97 | CleanUp 98 | InstallCompleted 99 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## 4 | ## 5 | ## 6 | ## 7 | ## 8 | # Love open-source, dev-tooling and passionate about code as much as we do? 9 | # --- 10 | # We're always looking for awesome hackers like you to join our 100% remote team! 11 | # Check and see if you find any relevant position @ https://appwrite.io/company/careers 👩‍💻 😎 12 | # (and let us know you found this message...) 13 | 14 | # This script contains hidden JS code to allow better readability and syntax highlighting 15 | # You can use "View source" of this page to see the full script. 16 | 17 | # Appwrite CLI location 18 | APPWRITE_INSTALL_DIR="/usr/local/bin" 19 | 20 | # Appwrite CLI Executable name 21 | APPWRITE_EXECUTABLE_NAME=appwrite 22 | 23 | # Appwrite executable file path 24 | APPWRITE_EXECUTABLE_FILEPATH="$APPWRITE_INSTALL_DIR/$APPWRITE_EXECUTABLE_NAME" 25 | 26 | # Appwrite CLI temp name 27 | APPWRITE_TEMP_NAME=temp-$(date +%s) 28 | 29 | # Appwrite CLI image name 30 | GITHUB_REPOSITORY_NAME=appwrite/sdk-for-cli 31 | 32 | # sudo is required to copy executable to APPWRITE_INSTALL_DIR for linux 33 | USE_SUDO="false" 34 | OS="" 35 | ARCH="" 36 | 37 | # Add some color to life 38 | RED='\033[0;31m' 39 | GREEN='\033[0;32m' 40 | NC='\033[0m' # No Color 41 | 42 | 43 | greeting() { 44 | echo -e "${RED}" 45 | cat << "EOF" 46 | 47 | _ _ _ ___ __ _____ 48 | /_\ _ __ _ ____ ___ __(_) |_ ___ / __\ / / \_ \ 49 | //_\\| '_ \| '_ \ \ /\ / / '__| | __/ _ \ / / / / / /\/ 50 | / _ \ |_) | |_) \ V V /| | | | || __/ / /___/ /___/\/ /_ 51 | \_/ \_/ .__/| .__/ \_/\_/ |_| |_|\__\___| \____/\____/\____/ 52 | |_| |_| 53 | EOF 54 | echo -e "${NC}\n" 55 | echo "🔥 Welcome to the Appwrite CLI install shield 🛡" 56 | } 57 | 58 | getSystemInfo() { 59 | echo "[1/4] Getting System Info ..." 60 | 61 | ARCH=$(uname -m) 62 | case $ARCH in 63 | i386|i686) ARCH="x64" ;; 64 | x86_64) ARCH="x64";; 65 | armv6*) ARCH="arm64" ;; 66 | armv7*) ARCH="arm64" ;; 67 | aarch64*) ARCH="arm64" ;; 68 | esac 69 | 70 | OS=$(echo `uname`|tr '[:upper:]' '[:lower:]') 71 | 72 | # Need root access if its a linux system 73 | if [ "$OS" == "linux" ] && [ "$APPWRITE_INSTALL_DIR" == "/usr/local/bin" ]; then 74 | USE_SUDO="true" 75 | fi 76 | 77 | # Need root access if its Apple Silicon 78 | if [ "$OS" == "darwin" ] && [[ "$(uname -a)" = *ARM64* ]]; then 79 | USE_SUDO="true" 80 | fi 81 | 82 | printf "${GREEN}\nOS : $OS \nARCH : $ARCH \nREQUIRES ROOT : $USE_SUDO\n\n${NC}" 83 | } 84 | 85 | runAsRoot() { 86 | local CMD="$*" 87 | if [ $EUID -ne 0 -a $USE_SUDO = "true" ]; then 88 | CMD="sudo $CMD" 89 | fi 90 | $CMD 91 | } 92 | 93 | printSuccess() { 94 | printf "${GREEN}✅ Done ... ${NC}\n\n" 95 | } 96 | 97 | downloadBinary() { 98 | echo "[2/4] Downloading executable for $OS ($ARCH) ..." 99 | 100 | GITHUB_LATEST_VERSION="7.0.0" 101 | GITHUB_FILE="appwrite-cli-${OS}-${ARCH}" 102 | GITHUB_URL="https://github.com/$GITHUB_REPOSITORY_NAME/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE" 103 | 104 | printf "${GREEN}🚦 Downloading Appwrite CLI $GITHUB_LATEST_VERSION ... ${NC}\n" 105 | res=$(curl -s $GITHUB_URL) 106 | if [[ "$res" == *"Not Found"* ]]; then 107 | printf "${RED}❌ Couldn't find executable for $OS ($ARCH). Please contact the Appwrite team ${NC} \n" 108 | exit 1 109 | fi 110 | curl -L -o $APPWRITE_TEMP_NAME $GITHUB_URL 111 | printSuccess 112 | } 113 | 114 | install() { 115 | echo "[3/4] Installing ..." 116 | 117 | printf "${GREEN}🚧 Setting Permissions ${NC}\n" 118 | chmod +x $APPWRITE_TEMP_NAME 119 | if [ $? -ne 0 ]; then 120 | printf "${RED}❌ Failed to set permissions ... ${NC}\n" 121 | exit 1 122 | fi 123 | printSuccess 124 | 125 | printf "${GREEN}📝 Copying temporary file to $APPWRITE_EXECUTABLE_FILEPATH ... ${NC}\n" 126 | runAsRoot cp $APPWRITE_TEMP_NAME $APPWRITE_EXECUTABLE_FILEPATH 127 | if [ $? -ne 0 ]; then 128 | printf "${RED}❌ Failed to copy temporary file to $APPWRITE_EXECUTABLE_FILEPATH ... ${NC}\n" 129 | exit 1 130 | fi 131 | printSuccess 132 | } 133 | 134 | cleanup() { 135 | printf "${GREEN}🧹 Cleaning up mess ... ${NC}\n" 136 | rm $APPWRITE_TEMP_NAME 137 | if [ $? -ne 0 ]; then 138 | printf "${RED}❌ Failed to remove temporary file ... ${NC}\n" 139 | exit 1 140 | fi 141 | printSuccess 142 | 143 | } 144 | 145 | installCompleted() { 146 | echo "[4/4] Wrapping up installation ... " 147 | cleanup 148 | echo "🚀 To get started with Appwrite CLI, please visit https://appwrite.io/docs/command-line" 149 | echo "As first step, you can login to your Appwrite account using 'appwrite login'" 150 | } 151 | 152 | # Installation Starts here 153 | greeting 154 | getSystemInfo 155 | downloadBinary 156 | install 157 | installCompleted -------------------------------------------------------------------------------- /lib/client.js: -------------------------------------------------------------------------------- 1 | const os = require('os'); 2 | const https = require("https"); 3 | const { fetch, FormData, Agent } = require("undici"); 4 | const JSONbig = require("json-bigint")({ storeAsString: false }); 5 | const AppwriteException = require("./exception.js"); 6 | const { globalConfig } = require("./config.js"); 7 | const chalk = require("chalk"); 8 | 9 | class Client { 10 | CHUNK_SIZE = 5*1024*1024; // 5MB 11 | 12 | constructor() { 13 | this.endpoint = 'https://cloud.appwrite.io/v1'; 14 | this.headers = { 15 | 'content-type': '', 16 | 'x-sdk-name': 'Command Line', 17 | 'x-sdk-platform': 'console', 18 | 'x-sdk-language': 'cli', 19 | 'x-sdk-version': '7.0.0', 20 | 'user-agent' : `AppwriteCLI/7.0.0 (${os.type()} ${os.version()}; ${os.arch()})`, 21 | 'X-Appwrite-Response-Format' : '1.7.0', 22 | }; 23 | } 24 | 25 | /** 26 | * Set Cookie 27 | * 28 | * Your cookie 29 | * 30 | * @param {string} cookie 31 | * 32 | * @return self 33 | */ 34 | setCookie(cookie) { 35 | this.addHeader("cookie", cookie); 36 | 37 | return this; 38 | } 39 | 40 | /** 41 | * Set Project 42 | * 43 | * Your project ID 44 | * 45 | * @param {string} project 46 | * 47 | * @return self 48 | */ 49 | setProject(project) { 50 | this.addHeader('X-Appwrite-Project', project); 51 | 52 | return this; 53 | } 54 | 55 | /** 56 | * Set Key 57 | * 58 | * Your secret API key 59 | * 60 | * @param {string} key 61 | * 62 | * @return self 63 | */ 64 | setKey(key) { 65 | this.addHeader('X-Appwrite-Key', key); 66 | 67 | return this; 68 | } 69 | 70 | /** 71 | * Set JWT 72 | * 73 | * Your secret JSON Web Token 74 | * 75 | * @param {string} jwt 76 | * 77 | * @return self 78 | */ 79 | setJWT(jwt) { 80 | this.addHeader('X-Appwrite-JWT', jwt); 81 | 82 | return this; 83 | } 84 | 85 | /** 86 | * Set Locale 87 | * 88 | * @param {string} locale 89 | * 90 | * @return self 91 | */ 92 | setLocale(locale) { 93 | this.addHeader('X-Appwrite-Locale', locale); 94 | 95 | return this; 96 | } 97 | 98 | /** 99 | * Set Mode 100 | * 101 | * @param {string} mode 102 | * 103 | * @return self 104 | */ 105 | setMode(mode) { 106 | this.addHeader('X-Appwrite-Mode', mode); 107 | 108 | return this; 109 | } 110 | 111 | /** 112 | * Set self signed. 113 | * 114 | * @param {bool} status 115 | * 116 | * @return this 117 | */ 118 | setSelfSigned(status) { 119 | this.selfSigned = status; 120 | 121 | return this; 122 | } 123 | 124 | /** 125 | * Set endpoint. 126 | * 127 | * @param {string} endpoint 128 | * 129 | * @return this 130 | */ 131 | setEndpoint(endpoint) { 132 | if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) { 133 | throw new AppwriteException('Invalid endpoint URL: ' + endpoint); 134 | } 135 | 136 | this.endpoint = endpoint; 137 | return this; 138 | } 139 | 140 | /** 141 | * @param {string} key 142 | * @param {string} value 143 | */ 144 | addHeader(key, value) { 145 | this.headers[key.toLowerCase()] = value; 146 | 147 | return this; 148 | } 149 | 150 | async call(method, path = "", headers = {}, params = {}, responseType = "json") { 151 | headers = {...this.headers, ...headers}; 152 | const url = new URL(this.endpoint + path); 153 | 154 | let body = undefined; 155 | 156 | if (method.toUpperCase() === "GET") { 157 | url.search = new URLSearchParams(Client.flatten(params)).toString(); 158 | } else if (headers["content-type"]?.toLowerCase().startsWith("multipart/form-data")) { 159 | delete headers["content-type"]; 160 | const formData = new FormData(); 161 | 162 | const flatParams = Client.flatten(params); 163 | 164 | for (const [key, value] of Object.entries(flatParams)) { 165 | if (value && value.type && value.type === "file") { 166 | formData.append(key, value.file, value.filename); 167 | } else { 168 | formData.append(key, value); 169 | } 170 | } 171 | 172 | body = formData; 173 | } else { 174 | body = JSONbig.stringify(params); 175 | } 176 | 177 | let response = undefined; 178 | try { 179 | response = await fetch(url.toString(), { 180 | method: method.toUpperCase(), 181 | headers, 182 | body, 183 | dispatcher: new Agent({ 184 | connect: { 185 | rejectUnauthorized: !this.selfSigned, 186 | }, 187 | }), 188 | }); 189 | 190 | const warnings = response.headers.get('x-appwrite-warning'); 191 | if (warnings) { 192 | warnings.split(';').forEach((warning) => console.warn(warning)); 193 | } 194 | } catch (error) { 195 | throw new AppwriteException(error.message); 196 | } 197 | 198 | if (response.status >= 400) { 199 | const text = await response.text(); 200 | let json = undefined; 201 | try { 202 | json = JSON.parse(text); 203 | } catch (error) { 204 | throw new AppwriteException(text, response.status, "", text); 205 | } 206 | 207 | if (path !== '/account' && json.code === 401 && json.type === 'user_more_factors_required') { 208 | console.log(`${chalk.cyan.bold("ℹ Info")} ${chalk.cyan("Unusable account found, removing...")}`); 209 | 210 | const current = globalConfig.getCurrentSession(); 211 | globalConfig.setCurrentSession(''); 212 | globalConfig.removeSession(current); 213 | } 214 | throw new AppwriteException(json.message, json.code, json.type, text); 215 | } 216 | 217 | if (responseType === "arraybuffer") { 218 | const data = await response.arrayBuffer(); 219 | return data; 220 | } 221 | 222 | let cookies = response.headers.getSetCookie(); 223 | if (cookies && cookies.length > 0) { 224 | for (const cookie of cookies) { 225 | if (cookie.startsWith('a_session_console=')) { 226 | globalConfig.setCookie(cookie); 227 | } 228 | } 229 | } 230 | 231 | const text = await response.text(); 232 | let json = undefined; 233 | try { 234 | json = JSONbig.parse(text); 235 | } catch (error) { 236 | return text; 237 | } 238 | return json; 239 | } 240 | 241 | static flatten(data, prefix = '') { 242 | let output = {}; 243 | 244 | for (const key in data) { 245 | let value = data[key]; 246 | let finalKey = prefix ? prefix + '[' + key +']' : key; 247 | 248 | if (Array.isArray(value)) { 249 | output = Object.assign(output, Client.flatten(value, finalKey)); // @todo: handle name collision here if needed 250 | } else { 251 | output[finalKey] = value; 252 | } 253 | } 254 | 255 | return output; 256 | } 257 | } 258 | 259 | module.exports = Client; 260 | -------------------------------------------------------------------------------- /lib/commands/assistant.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const pathLib = require('path'); 3 | const tar = require("tar"); 4 | const ignore = require("ignore"); 5 | const { promisify } = require('util'); 6 | const libClient = require('../client.js'); 7 | const { getAllFiles, showConsoleLink } = require('../utils.js'); 8 | const { Command } = require('commander'); 9 | const { sdkForProject, sdkForConsole } = require('../sdks') 10 | const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser') 11 | const { localConfig, globalConfig } = require("../config"); 12 | const { File } = require('undici'); 13 | const { ReadableStream } = require('stream/web'); 14 | 15 | /** 16 | * @param {fs.ReadStream} readStream 17 | * @returns {ReadableStream} 18 | */ 19 | function convertReadStreamToReadableStream(readStream) { 20 | return new ReadableStream({ 21 | start(controller) { 22 | readStream.on("data", (chunk) => { 23 | controller.enqueue(chunk); 24 | }); 25 | readStream.on("end", () => { 26 | controller.close(); 27 | }); 28 | readStream.on("error", (err) => { 29 | controller.error(err); 30 | }); 31 | }, 32 | cancel() { 33 | readStream.destroy(); 34 | }, 35 | }); 36 | } 37 | 38 | const assistant = new Command("assistant").description(commandDescriptions['assistant'] ?? '').configureHelp({ 39 | helpWidth: process.stdout.columns || 80 40 | }) 41 | 42 | /** 43 | * @typedef {Object} AssistantChatRequestParams 44 | * @property {string} prompt Prompt. A string containing questions asked to the AI assistant. 45 | * @property {boolean} overrideForCli 46 | * @property {boolean} parseOutput 47 | * @property {libClient | undefined} sdk 48 | */ 49 | 50 | /** 51 | * @param {AssistantChatRequestParams} params 52 | */ 53 | const assistantChat = async ({prompt,parseOutput = true, overrideForCli = false, sdk = undefined}) => { 54 | let client = !sdk ? await sdkForProject() : 55 | sdk; 56 | let apiPath = '/console/assistant'; 57 | let payload = {}; 58 | if (typeof prompt !== 'undefined') { 59 | payload['prompt'] = prompt; 60 | } 61 | 62 | let response = undefined; 63 | 64 | response = await client.call('post', apiPath, { 65 | 'content-type': 'application/json', 66 | }, payload); 67 | 68 | if (parseOutput) { 69 | parse(response) 70 | } 71 | 72 | return response; 73 | 74 | } 75 | 76 | assistant 77 | .command(`chat`) 78 | .description(`Send a prompt to the AI assistant and receive a response. This endpoint allows you to interact with Appwrite's AI assistant by sending questions or prompts and receiving helpful responses in real-time through a server-sent events stream. `) 79 | .requiredOption(`--prompt `, `Prompt. A string containing questions asked to the AI assistant.`) 80 | .action(actionRunner(assistantChat)) 81 | 82 | module.exports = { 83 | assistant, 84 | assistantChat 85 | }; 86 | -------------------------------------------------------------------------------- /lib/commands/console.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const pathLib = require('path'); 3 | const tar = require("tar"); 4 | const ignore = require("ignore"); 5 | const { promisify } = require('util'); 6 | const libClient = require('../client.js'); 7 | const { getAllFiles, showConsoleLink } = require('../utils.js'); 8 | const { Command } = require('commander'); 9 | const { sdkForProject, sdkForConsole } = require('../sdks') 10 | const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser') 11 | const { localConfig, globalConfig } = require("../config"); 12 | const { File } = require('undici'); 13 | const { ReadableStream } = require('stream/web'); 14 | 15 | /** 16 | * @param {fs.ReadStream} readStream 17 | * @returns {ReadableStream} 18 | */ 19 | function convertReadStreamToReadableStream(readStream) { 20 | return new ReadableStream({ 21 | start(controller) { 22 | readStream.on("data", (chunk) => { 23 | controller.enqueue(chunk); 24 | }); 25 | readStream.on("end", () => { 26 | controller.close(); 27 | }); 28 | readStream.on("error", (err) => { 29 | controller.error(err); 30 | }); 31 | }, 32 | cancel() { 33 | readStream.destroy(); 34 | }, 35 | }); 36 | } 37 | 38 | const console = new Command("console").description(commandDescriptions['console'] ?? '').configureHelp({ 39 | helpWidth: process.stdout.columns || 80 40 | }) 41 | 42 | /** 43 | * @typedef {Object} ConsoleGetResourceRequestParams 44 | * @property {string} value Resource value. 45 | * @property {ConsoleResourceType} type Resource type. 46 | * @property {boolean} overrideForCli 47 | * @property {boolean} parseOutput 48 | * @property {libClient | undefined} sdk 49 | */ 50 | 51 | /** 52 | * @param {ConsoleGetResourceRequestParams} params 53 | */ 54 | const consoleGetResource = async ({value,type,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => { 55 | let client = !sdk ? await sdkForProject() : 56 | sdk; 57 | let apiPath = '/console/resources'; 58 | let payload = {}; 59 | if (typeof value !== 'undefined') { 60 | payload['value'] = value; 61 | } 62 | if (typeof type !== 'undefined') { 63 | payload['type'] = type; 64 | } 65 | 66 | let response = undefined; 67 | 68 | response = await client.call('get', apiPath, { 69 | }, payload); 70 | 71 | if (parseOutput) { 72 | if(console) { 73 | showConsoleLink('console', 'getResource'); 74 | } else { 75 | parse(response) 76 | } 77 | } 78 | 79 | return response; 80 | 81 | } 82 | 83 | /** 84 | * @typedef {Object} ConsoleVariablesRequestParams 85 | * @property {boolean} overrideForCli 86 | * @property {boolean} parseOutput 87 | * @property {libClient | undefined} sdk 88 | */ 89 | 90 | /** 91 | * @param {ConsoleVariablesRequestParams} params 92 | */ 93 | const consoleVariables = async ({parseOutput = true, overrideForCli = false, sdk = undefined}) => { 94 | let client = !sdk ? await sdkForProject() : 95 | sdk; 96 | let apiPath = '/console/variables'; 97 | let payload = {}; 98 | 99 | let response = undefined; 100 | 101 | response = await client.call('get', apiPath, { 102 | }, payload); 103 | 104 | if (parseOutput) { 105 | parse(response) 106 | } 107 | 108 | return response; 109 | 110 | } 111 | 112 | console 113 | .command(`get-resource`) 114 | .description(`Check if a resource ID is available.`) 115 | .requiredOption(`--value `, `Resource value.`) 116 | .requiredOption(`--type `, `Resource type.`) 117 | .option(`--console`, `Get the resource console url`) 118 | .action(actionRunner(consoleGetResource)) 119 | 120 | console 121 | .command(`variables`) 122 | .description(`Get all Environment Variables that are relevant for the console.`) 123 | .action(actionRunner(consoleVariables)) 124 | 125 | module.exports = { 126 | console, 127 | consoleGetResource, 128 | consoleVariables 129 | }; 130 | -------------------------------------------------------------------------------- /lib/commands/graphql.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const pathLib = require('path'); 3 | const tar = require("tar"); 4 | const ignore = require("ignore"); 5 | const { promisify } = require('util'); 6 | const libClient = require('../client.js'); 7 | const { getAllFiles, showConsoleLink } = require('../utils.js'); 8 | const { Command } = require('commander'); 9 | const { sdkForProject, sdkForConsole } = require('../sdks') 10 | const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser') 11 | const { localConfig, globalConfig } = require("../config"); 12 | const { File } = require('undici'); 13 | const { ReadableStream } = require('stream/web'); 14 | 15 | /** 16 | * @param {fs.ReadStream} readStream 17 | * @returns {ReadableStream} 18 | */ 19 | function convertReadStreamToReadableStream(readStream) { 20 | return new ReadableStream({ 21 | start(controller) { 22 | readStream.on("data", (chunk) => { 23 | controller.enqueue(chunk); 24 | }); 25 | readStream.on("end", () => { 26 | controller.close(); 27 | }); 28 | readStream.on("error", (err) => { 29 | controller.error(err); 30 | }); 31 | }, 32 | cancel() { 33 | readStream.destroy(); 34 | }, 35 | }); 36 | } 37 | 38 | const graphql = new Command("graphql").description(commandDescriptions['graphql'] ?? '').configureHelp({ 39 | helpWidth: process.stdout.columns || 80 40 | }) 41 | 42 | /** 43 | * @typedef {Object} GraphqlQueryRequestParams 44 | * @property {object} query The query or queries to execute. 45 | * @property {boolean} overrideForCli 46 | * @property {boolean} parseOutput 47 | * @property {libClient | undefined} sdk 48 | */ 49 | 50 | /** 51 | * @param {GraphqlQueryRequestParams} params 52 | */ 53 | const graphqlQuery = async ({query,parseOutput = true, overrideForCli = false, sdk = undefined}) => { 54 | let client = !sdk ? await sdkForProject() : 55 | sdk; 56 | let apiPath = '/graphql'; 57 | let payload = {}; 58 | if (typeof query !== 'undefined') { 59 | payload['query'] = JSON.parse(query); 60 | } 61 | 62 | let response = undefined; 63 | 64 | response = await client.call('post', apiPath, { 65 | 'x-sdk-graphql': 'true', 66 | 'content-type': 'application/json', 67 | }, payload); 68 | 69 | if (parseOutput) { 70 | parse(response) 71 | } 72 | 73 | return response; 74 | 75 | } 76 | 77 | /** 78 | * @typedef {Object} GraphqlMutationRequestParams 79 | * @property {object} query The query or queries to execute. 80 | * @property {boolean} overrideForCli 81 | * @property {boolean} parseOutput 82 | * @property {libClient | undefined} sdk 83 | */ 84 | 85 | /** 86 | * @param {GraphqlMutationRequestParams} params 87 | */ 88 | const graphqlMutation = async ({query,parseOutput = true, overrideForCli = false, sdk = undefined}) => { 89 | let client = !sdk ? await sdkForProject() : 90 | sdk; 91 | let apiPath = '/graphql/mutation'; 92 | let payload = {}; 93 | if (typeof query !== 'undefined') { 94 | payload['query'] = JSON.parse(query); 95 | } 96 | 97 | let response = undefined; 98 | 99 | response = await client.call('post', apiPath, { 100 | 'x-sdk-graphql': 'true', 101 | 'content-type': 'application/json', 102 | }, payload); 103 | 104 | if (parseOutput) { 105 | parse(response) 106 | } 107 | 108 | return response; 109 | 110 | } 111 | 112 | graphql 113 | .command(`query`) 114 | .description(`Execute a GraphQL mutation.`) 115 | .requiredOption(`--query `, `The query or queries to execute.`) 116 | .action(actionRunner(graphqlQuery)) 117 | 118 | graphql 119 | .command(`mutation`) 120 | .description(`Execute a GraphQL mutation.`) 121 | .requiredOption(`--query `, `The query or queries to execute.`) 122 | .action(actionRunner(graphqlMutation)) 123 | 124 | module.exports = { 125 | graphql, 126 | graphqlQuery, 127 | graphqlMutation 128 | }; 129 | -------------------------------------------------------------------------------- /lib/commands/locale.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const pathLib = require('path'); 3 | const tar = require("tar"); 4 | const ignore = require("ignore"); 5 | const { promisify } = require('util'); 6 | const libClient = require('../client.js'); 7 | const { getAllFiles, showConsoleLink } = require('../utils.js'); 8 | const { Command } = require('commander'); 9 | const { sdkForProject, sdkForConsole } = require('../sdks') 10 | const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser') 11 | const { localConfig, globalConfig } = require("../config"); 12 | const { File } = require('undici'); 13 | const { ReadableStream } = require('stream/web'); 14 | 15 | /** 16 | * @param {fs.ReadStream} readStream 17 | * @returns {ReadableStream} 18 | */ 19 | function convertReadStreamToReadableStream(readStream) { 20 | return new ReadableStream({ 21 | start(controller) { 22 | readStream.on("data", (chunk) => { 23 | controller.enqueue(chunk); 24 | }); 25 | readStream.on("end", () => { 26 | controller.close(); 27 | }); 28 | readStream.on("error", (err) => { 29 | controller.error(err); 30 | }); 31 | }, 32 | cancel() { 33 | readStream.destroy(); 34 | }, 35 | }); 36 | } 37 | 38 | const locale = new Command("locale").description(commandDescriptions['locale'] ?? '').configureHelp({ 39 | helpWidth: process.stdout.columns || 80 40 | }) 41 | 42 | /** 43 | * @typedef {Object} LocaleGetRequestParams 44 | * @property {boolean} overrideForCli 45 | * @property {boolean} parseOutput 46 | * @property {libClient | undefined} sdk 47 | */ 48 | 49 | /** 50 | * @param {LocaleGetRequestParams} params 51 | */ 52 | const localeGet = async ({parseOutput = true, overrideForCli = false, sdk = undefined}) => { 53 | let client = !sdk ? await sdkForProject() : 54 | sdk; 55 | let apiPath = '/locale'; 56 | let payload = {}; 57 | 58 | let response = undefined; 59 | 60 | response = await client.call('get', apiPath, { 61 | }, payload); 62 | 63 | if (parseOutput) { 64 | parse(response) 65 | } 66 | 67 | return response; 68 | 69 | } 70 | 71 | /** 72 | * @typedef {Object} LocaleListCodesRequestParams 73 | * @property {boolean} overrideForCli 74 | * @property {boolean} parseOutput 75 | * @property {libClient | undefined} sdk 76 | */ 77 | 78 | /** 79 | * @param {LocaleListCodesRequestParams} params 80 | */ 81 | const localeListCodes = async ({parseOutput = true, overrideForCli = false, sdk = undefined}) => { 82 | let client = !sdk ? await sdkForProject() : 83 | sdk; 84 | let apiPath = '/locale/codes'; 85 | let payload = {}; 86 | 87 | let response = undefined; 88 | 89 | response = await client.call('get', apiPath, { 90 | }, payload); 91 | 92 | if (parseOutput) { 93 | parse(response) 94 | } 95 | 96 | return response; 97 | 98 | } 99 | 100 | /** 101 | * @typedef {Object} LocaleListContinentsRequestParams 102 | * @property {boolean} overrideForCli 103 | * @property {boolean} parseOutput 104 | * @property {libClient | undefined} sdk 105 | */ 106 | 107 | /** 108 | * @param {LocaleListContinentsRequestParams} params 109 | */ 110 | const localeListContinents = async ({parseOutput = true, overrideForCli = false, sdk = undefined}) => { 111 | let client = !sdk ? await sdkForProject() : 112 | sdk; 113 | let apiPath = '/locale/continents'; 114 | let payload = {}; 115 | 116 | let response = undefined; 117 | 118 | response = await client.call('get', apiPath, { 119 | }, payload); 120 | 121 | if (parseOutput) { 122 | parse(response) 123 | } 124 | 125 | return response; 126 | 127 | } 128 | 129 | /** 130 | * @typedef {Object} LocaleListCountriesRequestParams 131 | * @property {boolean} overrideForCli 132 | * @property {boolean} parseOutput 133 | * @property {libClient | undefined} sdk 134 | */ 135 | 136 | /** 137 | * @param {LocaleListCountriesRequestParams} params 138 | */ 139 | const localeListCountries = async ({parseOutput = true, overrideForCli = false, sdk = undefined}) => { 140 | let client = !sdk ? await sdkForProject() : 141 | sdk; 142 | let apiPath = '/locale/countries'; 143 | let payload = {}; 144 | 145 | let response = undefined; 146 | 147 | response = await client.call('get', apiPath, { 148 | }, payload); 149 | 150 | if (parseOutput) { 151 | parse(response) 152 | } 153 | 154 | return response; 155 | 156 | } 157 | 158 | /** 159 | * @typedef {Object} LocaleListCountriesEURequestParams 160 | * @property {boolean} overrideForCli 161 | * @property {boolean} parseOutput 162 | * @property {libClient | undefined} sdk 163 | */ 164 | 165 | /** 166 | * @param {LocaleListCountriesEURequestParams} params 167 | */ 168 | const localeListCountriesEU = async ({parseOutput = true, overrideForCli = false, sdk = undefined}) => { 169 | let client = !sdk ? await sdkForProject() : 170 | sdk; 171 | let apiPath = '/locale/countries/eu'; 172 | let payload = {}; 173 | 174 | let response = undefined; 175 | 176 | response = await client.call('get', apiPath, { 177 | }, payload); 178 | 179 | if (parseOutput) { 180 | parse(response) 181 | } 182 | 183 | return response; 184 | 185 | } 186 | 187 | /** 188 | * @typedef {Object} LocaleListCountriesPhonesRequestParams 189 | * @property {boolean} overrideForCli 190 | * @property {boolean} parseOutput 191 | * @property {libClient | undefined} sdk 192 | */ 193 | 194 | /** 195 | * @param {LocaleListCountriesPhonesRequestParams} params 196 | */ 197 | const localeListCountriesPhones = async ({parseOutput = true, overrideForCli = false, sdk = undefined}) => { 198 | let client = !sdk ? await sdkForProject() : 199 | sdk; 200 | let apiPath = '/locale/countries/phones'; 201 | let payload = {}; 202 | 203 | let response = undefined; 204 | 205 | response = await client.call('get', apiPath, { 206 | }, payload); 207 | 208 | if (parseOutput) { 209 | parse(response) 210 | } 211 | 212 | return response; 213 | 214 | } 215 | 216 | /** 217 | * @typedef {Object} LocaleListCurrenciesRequestParams 218 | * @property {boolean} overrideForCli 219 | * @property {boolean} parseOutput 220 | * @property {libClient | undefined} sdk 221 | */ 222 | 223 | /** 224 | * @param {LocaleListCurrenciesRequestParams} params 225 | */ 226 | const localeListCurrencies = async ({parseOutput = true, overrideForCli = false, sdk = undefined}) => { 227 | let client = !sdk ? await sdkForProject() : 228 | sdk; 229 | let apiPath = '/locale/currencies'; 230 | let payload = {}; 231 | 232 | let response = undefined; 233 | 234 | response = await client.call('get', apiPath, { 235 | }, payload); 236 | 237 | if (parseOutput) { 238 | parse(response) 239 | } 240 | 241 | return response; 242 | 243 | } 244 | 245 | /** 246 | * @typedef {Object} LocaleListLanguagesRequestParams 247 | * @property {boolean} overrideForCli 248 | * @property {boolean} parseOutput 249 | * @property {libClient | undefined} sdk 250 | */ 251 | 252 | /** 253 | * @param {LocaleListLanguagesRequestParams} params 254 | */ 255 | const localeListLanguages = async ({parseOutput = true, overrideForCli = false, sdk = undefined}) => { 256 | let client = !sdk ? await sdkForProject() : 257 | sdk; 258 | let apiPath = '/locale/languages'; 259 | let payload = {}; 260 | 261 | let response = undefined; 262 | 263 | response = await client.call('get', apiPath, { 264 | }, payload); 265 | 266 | if (parseOutput) { 267 | parse(response) 268 | } 269 | 270 | return response; 271 | 272 | } 273 | 274 | locale 275 | .command(`get`) 276 | .description(`Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language. ([IP Geolocation by DB-IP](https://db-ip.com))`) 277 | .action(actionRunner(localeGet)) 278 | 279 | locale 280 | .command(`list-codes`) 281 | .description(`List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).`) 282 | .action(actionRunner(localeListCodes)) 283 | 284 | locale 285 | .command(`list-continents`) 286 | .description(`List of all continents. You can use the locale header to get the data in a supported language.`) 287 | .action(actionRunner(localeListContinents)) 288 | 289 | locale 290 | .command(`list-countries`) 291 | .description(`List of all countries. You can use the locale header to get the data in a supported language.`) 292 | .action(actionRunner(localeListCountries)) 293 | 294 | locale 295 | .command(`list-countries-eu`) 296 | .description(`List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.`) 297 | .action(actionRunner(localeListCountriesEU)) 298 | 299 | locale 300 | .command(`list-countries-phones`) 301 | .description(`List of all countries phone codes. You can use the locale header to get the data in a supported language.`) 302 | .action(actionRunner(localeListCountriesPhones)) 303 | 304 | locale 305 | .command(`list-currencies`) 306 | .description(`List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.`) 307 | .action(actionRunner(localeListCurrencies)) 308 | 309 | locale 310 | .command(`list-languages`) 311 | .description(`List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.`) 312 | .action(actionRunner(localeListLanguages)) 313 | 314 | module.exports = { 315 | locale, 316 | localeGet, 317 | localeListCodes, 318 | localeListContinents, 319 | localeListCountries, 320 | localeListCountriesEU, 321 | localeListCountriesPhones, 322 | localeListCurrencies, 323 | localeListLanguages 324 | }; 325 | -------------------------------------------------------------------------------- /lib/commands/organizations.js: -------------------------------------------------------------------------------- 1 | const { sdkForProject } = require('../sdks') 2 | const { parse } = require('../parser') 3 | const { showConsoleLink } = require('../utils.js'); 4 | 5 | /** 6 | * @typedef {Object} OrganizationsListRequestParams 7 | * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, total, billingPlan 8 | * @property {string} search Search term to filter your list results. Max length: 256 chars. 9 | * @property {boolean} parseOutput 10 | * @property {libClient | undefined} sdk 11 | */ 12 | 13 | /** 14 | * @param {OrganizationsListRequestParams} params 15 | */ 16 | const organizationsList = async ({queries, search, parseOutput = true, sdk = undefined, console}) => { 17 | let client = !sdk ? await sdkForProject() : 18 | sdk; 19 | let apiPath = '/organizations'; 20 | let payload = {}; 21 | if (typeof queries !== 'undefined') { 22 | payload['queries'] = queries; 23 | } 24 | if (typeof search !== 'undefined') { 25 | payload['search'] = search; 26 | } 27 | 28 | let response = undefined; 29 | 30 | response = await client.call('get', apiPath, { 31 | 'content-type': 'application/json', 32 | }, payload); 33 | 34 | if (parseOutput) { 35 | if(console) { 36 | showConsoleLink('organizations', 'list'); 37 | } else { 38 | parse(response) 39 | } 40 | } 41 | 42 | return response; 43 | 44 | } 45 | 46 | module.exports = { 47 | organizationsList 48 | } -------------------------------------------------------------------------------- /lib/commands/tokens.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const pathLib = require('path'); 3 | const tar = require("tar"); 4 | const ignore = require("ignore"); 5 | const { promisify } = require('util'); 6 | const libClient = require('../client.js'); 7 | const { getAllFiles, showConsoleLink } = require('../utils.js'); 8 | const { Command } = require('commander'); 9 | const { sdkForProject, sdkForConsole } = require('../sdks') 10 | const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser') 11 | const { localConfig, globalConfig } = require("../config"); 12 | const { File } = require('undici'); 13 | const { ReadableStream } = require('stream/web'); 14 | 15 | /** 16 | * @param {fs.ReadStream} readStream 17 | * @returns {ReadableStream} 18 | */ 19 | function convertReadStreamToReadableStream(readStream) { 20 | return new ReadableStream({ 21 | start(controller) { 22 | readStream.on("data", (chunk) => { 23 | controller.enqueue(chunk); 24 | }); 25 | readStream.on("end", () => { 26 | controller.close(); 27 | }); 28 | readStream.on("error", (err) => { 29 | controller.error(err); 30 | }); 31 | }, 32 | cancel() { 33 | readStream.destroy(); 34 | }, 35 | }); 36 | } 37 | 38 | const tokens = new Command("tokens").description(commandDescriptions['tokens'] ?? '').configureHelp({ 39 | helpWidth: process.stdout.columns || 80 40 | }) 41 | 42 | /** 43 | * @typedef {Object} TokensListRequestParams 44 | * @property {string} bucketId Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). 45 | * @property {string} fileId File unique ID. 46 | * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire 47 | * @property {boolean} overrideForCli 48 | * @property {boolean} parseOutput 49 | * @property {libClient | undefined} sdk 50 | */ 51 | 52 | /** 53 | * @param {TokensListRequestParams} params 54 | */ 55 | const tokensList = async ({bucketId,fileId,queries,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => { 56 | let client = !sdk ? await sdkForProject() : 57 | sdk; 58 | let apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); 59 | let payload = {}; 60 | if (typeof queries !== 'undefined') { 61 | payload['queries'] = queries; 62 | } 63 | 64 | let response = undefined; 65 | 66 | response = await client.call('get', apiPath, { 67 | }, payload); 68 | 69 | if (parseOutput) { 70 | if(console) { 71 | showConsoleLink('tokens', 'list', bucketId, fileId); 72 | } else { 73 | parse(response) 74 | } 75 | } 76 | 77 | return response; 78 | 79 | } 80 | 81 | /** 82 | * @typedef {Object} TokensCreateFileTokenRequestParams 83 | * @property {string} bucketId Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). 84 | * @property {string} fileId File unique ID. 85 | * @property {string} expire Token expiry date 86 | * @property {boolean} overrideForCli 87 | * @property {boolean} parseOutput 88 | * @property {libClient | undefined} sdk 89 | */ 90 | 91 | /** 92 | * @param {TokensCreateFileTokenRequestParams} params 93 | */ 94 | const tokensCreateFileToken = async ({bucketId,fileId,expire,parseOutput = true, overrideForCli = false, sdk = undefined}) => { 95 | let client = !sdk ? await sdkForProject() : 96 | sdk; 97 | let apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); 98 | let payload = {}; 99 | if (typeof expire !== 'undefined') { 100 | payload['expire'] = expire; 101 | } 102 | 103 | let response = undefined; 104 | 105 | response = await client.call('post', apiPath, { 106 | 'content-type': 'application/json', 107 | }, payload); 108 | 109 | if (parseOutput) { 110 | parse(response) 111 | } 112 | 113 | return response; 114 | 115 | } 116 | 117 | /** 118 | * @typedef {Object} TokensGetRequestParams 119 | * @property {string} tokenId Token ID. 120 | * @property {boolean} overrideForCli 121 | * @property {boolean} parseOutput 122 | * @property {libClient | undefined} sdk 123 | */ 124 | 125 | /** 126 | * @param {TokensGetRequestParams} params 127 | */ 128 | const tokensGet = async ({tokenId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => { 129 | let client = !sdk ? await sdkForProject() : 130 | sdk; 131 | let apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId); 132 | let payload = {}; 133 | 134 | let response = undefined; 135 | 136 | response = await client.call('get', apiPath, { 137 | }, payload); 138 | 139 | if (parseOutput) { 140 | if(console) { 141 | showConsoleLink('tokens', 'get', tokenId); 142 | } else { 143 | parse(response) 144 | } 145 | } 146 | 147 | return response; 148 | 149 | } 150 | 151 | /** 152 | * @typedef {Object} TokensUpdateRequestParams 153 | * @property {string} tokenId Token unique ID. 154 | * @property {string} expire File token expiry date 155 | * @property {boolean} overrideForCli 156 | * @property {boolean} parseOutput 157 | * @property {libClient | undefined} sdk 158 | */ 159 | 160 | /** 161 | * @param {TokensUpdateRequestParams} params 162 | */ 163 | const tokensUpdate = async ({tokenId,expire,parseOutput = true, overrideForCli = false, sdk = undefined}) => { 164 | let client = !sdk ? await sdkForProject() : 165 | sdk; 166 | let apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId); 167 | let payload = {}; 168 | if (typeof expire !== 'undefined') { 169 | payload['expire'] = expire; 170 | } 171 | 172 | let response = undefined; 173 | 174 | response = await client.call('patch', apiPath, { 175 | 'content-type': 'application/json', 176 | }, payload); 177 | 178 | if (parseOutput) { 179 | parse(response) 180 | } 181 | 182 | return response; 183 | 184 | } 185 | 186 | /** 187 | * @typedef {Object} TokensDeleteRequestParams 188 | * @property {string} tokenId Token ID. 189 | * @property {boolean} overrideForCli 190 | * @property {boolean} parseOutput 191 | * @property {libClient | undefined} sdk 192 | */ 193 | 194 | /** 195 | * @param {TokensDeleteRequestParams} params 196 | */ 197 | const tokensDelete = async ({tokenId,parseOutput = true, overrideForCli = false, sdk = undefined}) => { 198 | let client = !sdk ? await sdkForProject() : 199 | sdk; 200 | let apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId); 201 | let payload = {}; 202 | 203 | let response = undefined; 204 | 205 | response = await client.call('delete', apiPath, { 206 | 'content-type': 'application/json', 207 | }, payload); 208 | 209 | if (parseOutput) { 210 | parse(response) 211 | } 212 | 213 | return response; 214 | 215 | } 216 | 217 | tokens 218 | .command(`list`) 219 | .description(`List all the tokens created for a specific file or bucket. You can use the query params to filter your results.`) 220 | .requiredOption(`--bucket-id `, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`) 221 | .requiredOption(`--file-id `, `File unique ID.`) 222 | .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire`) 223 | .option(`--console`, `Get the resource console url`) 224 | .action(actionRunner(tokensList)) 225 | 226 | tokens 227 | .command(`create-file-token`) 228 | .description(`Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.`) 229 | .requiredOption(`--bucket-id `, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`) 230 | .requiredOption(`--file-id `, `File unique ID.`) 231 | .option(`--expire `, `Token expiry date`) 232 | .action(actionRunner(tokensCreateFileToken)) 233 | 234 | tokens 235 | .command(`get`) 236 | .description(`Get a token by its unique ID.`) 237 | .requiredOption(`--token-id `, `Token ID.`) 238 | .option(`--console`, `Get the resource console url`) 239 | .action(actionRunner(tokensGet)) 240 | 241 | tokens 242 | .command(`update`) 243 | .description(`Update a token by its unique ID. Use this endpoint to update a token's expiry date.`) 244 | .requiredOption(`--token-id `, `Token unique ID.`) 245 | .option(`--expire `, `File token expiry date`) 246 | .action(actionRunner(tokensUpdate)) 247 | 248 | tokens 249 | .command(`delete`) 250 | .description(`Delete a token by its unique ID.`) 251 | .requiredOption(`--token-id `, `Token ID.`) 252 | .action(actionRunner(tokensDelete)) 253 | 254 | module.exports = { 255 | tokens, 256 | tokensList, 257 | tokensCreateFileToken, 258 | tokensGet, 259 | tokensUpdate, 260 | tokensDelete 261 | }; 262 | -------------------------------------------------------------------------------- /lib/emulation/docker.js: -------------------------------------------------------------------------------- 1 | const tar = require("tar"); 2 | const ignore = require("ignore"); 3 | const net = require('net'); 4 | const chalk = require('chalk'); 5 | const childProcess = require('child_process'); 6 | const { localConfig } = require("../config"); 7 | const path = require('path'); 8 | const fs = require('fs'); 9 | const { log, error, success, hint } = require("../parser"); 10 | const { openRuntimesVersion, systemTools, Queue } = require("./utils"); 11 | const { getAllFiles } = require("../utils"); 12 | 13 | async function dockerStop(id) { 14 | const stopProcess = childProcess.spawn('docker', ['rm', '--force', id], { 15 | stdio: 'pipe', 16 | env: { 17 | ...process.env, 18 | DOCKER_CLI_HINTS: 'false' 19 | } 20 | }); 21 | 22 | await new Promise((res) => { stopProcess.on('close', res) }); 23 | } 24 | 25 | async function dockerPull(func) { 26 | const runtimeChunks = func.runtime.split("-"); 27 | const runtimeVersion = runtimeChunks.pop(); 28 | const runtimeName = runtimeChunks.join("-"); 29 | const imageName = `openruntimes/${runtimeName}:${openRuntimesVersion}-${runtimeVersion}`; 30 | 31 | log('Verifying Docker image ...'); 32 | 33 | const pullProcess = childProcess.spawn('docker', ['pull', imageName], { 34 | stdio: 'pipe', 35 | env: { 36 | ...process.env, 37 | DOCKER_CLI_HINTS: 'false' 38 | } 39 | }); 40 | 41 | await new Promise((res) => { pullProcess.on('close', res) }); 42 | } 43 | 44 | async function dockerBuild(func, variables) { 45 | const runtimeChunks = func.runtime.split("-"); 46 | const runtimeVersion = runtimeChunks.pop(); 47 | const runtimeName = runtimeChunks.join("-"); 48 | const imageName = `openruntimes/${runtimeName}:${openRuntimesVersion}-${runtimeVersion}`; 49 | 50 | const functionDir = path.join(localConfig.getDirname(), func.path); 51 | 52 | const id = func.$id; 53 | 54 | const ignorer = ignore(); 55 | ignorer.add('.appwrite'); 56 | if (func.ignore) { 57 | ignorer.add(func.ignore); 58 | } else if (fs.existsSync(path.join(functionDir, '.gitignore'))) { 59 | ignorer.add(fs.readFileSync(path.join(functionDir, '.gitignore')).toString()); 60 | } 61 | 62 | const files = getAllFiles(functionDir).map((file) => path.relative(functionDir, file)).filter((file) => !ignorer.ignores(file)); 63 | const tmpBuildPath = path.join(functionDir, '.appwrite/tmp-build'); 64 | if (!fs.existsSync(tmpBuildPath)) { 65 | fs.mkdirSync(tmpBuildPath, { recursive: true }); 66 | } 67 | 68 | for(const f of files) { 69 | const filePath = path.join(tmpBuildPath, f); 70 | const fileDir = path.dirname(filePath); 71 | if (!fs.existsSync(fileDir)) { 72 | fs.mkdirSync(fileDir, { recursive: true }); 73 | } 74 | 75 | const sourcePath = path.join(functionDir, f); 76 | fs.copyFileSync(sourcePath, filePath); 77 | } 78 | 79 | const params = [ 'run' ]; 80 | params.push('--name', id); 81 | params.push('-v', `${tmpBuildPath}/:/mnt/code:rw`); 82 | params.push('-e', 'OPEN_RUNTIMES_ENV=development'); 83 | params.push('-e', 'OPEN_RUNTIMES_SECRET='); 84 | params.push('-e', `OPEN_RUNTIMES_ENTRYPOINT=${func.entrypoint}`); 85 | 86 | for(const k of Object.keys(variables)) { 87 | params.push('-e', `${k}=${variables[k]}`); 88 | } 89 | 90 | params.push(imageName, 'sh', '-c', `helpers/build.sh "${func.commands}"`); 91 | 92 | const buildProcess = childProcess.spawn('docker', params, { 93 | stdio: 'pipe', 94 | pwd: functionDir, 95 | env: { 96 | ...process.env, 97 | DOCKER_CLI_HINTS: 'false' 98 | } 99 | }); 100 | 101 | buildProcess.stdout.on('data', (data) => { 102 | process.stdout.write(chalk.blackBright(`${data}\n`)); 103 | }); 104 | 105 | buildProcess.stderr.on('data', (data) => { 106 | process.stderr.write(chalk.blackBright(`${data}\n`)); 107 | }); 108 | 109 | const killInterval = setInterval(() => { 110 | if(!Queue.isEmpty()) { 111 | log('Cancelling build ...'); 112 | buildProcess.stdout.destroy(); 113 | buildProcess.stdin.destroy(); 114 | buildProcess.stderr.destroy(); 115 | buildProcess.kill("SIGKILL"); 116 | clearInterval(killInterval); 117 | } 118 | }, 100); 119 | 120 | await new Promise((res) => { buildProcess.on('close', res) }); 121 | 122 | clearInterval(killInterval); 123 | if(!Queue.isEmpty()) { 124 | return; 125 | } 126 | 127 | const copyPath = path.join(localConfig.getDirname(), func.path, '.appwrite', 'build.tar.gz'); 128 | const copyDir = path.dirname(copyPath); 129 | if (!fs.existsSync(copyDir)) { 130 | fs.mkdirSync(copyDir, { recursive: true }); 131 | } 132 | 133 | const copyProcess = childProcess.spawn('docker', ['cp', `${id}:/mnt/code/code.tar.gz`, copyPath], { 134 | stdio: 'pipe', 135 | pwd: functionDir, 136 | env: { 137 | ...process.env, 138 | DOCKER_CLI_HINTS: 'false' 139 | } 140 | }); 141 | 142 | await new Promise((res) => { copyProcess.on('close', res) }); 143 | 144 | await dockerStop(id); 145 | 146 | const tempPath = path.join(localConfig.getDirname(), func.path, 'code.tar.gz'); 147 | if (fs.existsSync(tempPath)) { 148 | fs.rmSync(tempPath, { force: true }); 149 | } 150 | 151 | fs.rmSync(tmpBuildPath, { recursive: true, force: true }); 152 | } 153 | 154 | async function dockerStart(func, variables, port) { 155 | // Pack function files 156 | const functionDir = path.join(localConfig.getDirname(), func.path); 157 | 158 | const runtimeChunks = func.runtime.split("-"); 159 | const runtimeVersion = runtimeChunks.pop(); 160 | const runtimeName = runtimeChunks.join("-"); 161 | const imageName = `openruntimes/${runtimeName}:${openRuntimesVersion}-${runtimeVersion}`; 162 | 163 | const tool = systemTools[runtimeName]; 164 | 165 | const id = func.$id; 166 | 167 | const params = [ 'run' ]; 168 | params.push('--rm'); 169 | params.push('--name', id); 170 | params.push('-p', `${port}:3000`); 171 | params.push('-e', 'OPEN_RUNTIMES_ENV=development'); 172 | params.push('-e', 'OPEN_RUNTIMES_SECRET='); 173 | 174 | for(const k of Object.keys(variables)) { 175 | params.push('-e', `${k}=${variables[k]}`); 176 | } 177 | 178 | params.push('-v', `${functionDir}/.appwrite/logs.txt:/mnt/logs/dev_logs.log:rw`); 179 | params.push('-v', `${functionDir}/.appwrite/errors.txt:/mnt/logs/dev_errors.log:rw`); 180 | params.push('-v', `${functionDir}/.appwrite/build.tar.gz:/mnt/code/code.tar.gz:ro`); 181 | params.push(imageName, 'sh', '-c', `helpers/start.sh "${tool.startCommand}"`); 182 | 183 | const startProcess = childProcess.spawn('docker', params, { 184 | stdio: 'pipe', 185 | pwd: functionDir, 186 | env: { 187 | ...process.env, 188 | DOCKER_CLI_HINTS: 'false' 189 | } 190 | }); 191 | 192 | startProcess.stdout.on('data', (data) => { 193 | process.stdout.write(chalk.blackBright(data)); 194 | }); 195 | 196 | startProcess.stderr.on('data', (data) => { 197 | process.stdout.write(chalk.blackBright(data)); 198 | }); 199 | 200 | try { 201 | await waitUntilPortOpen(port); 202 | } catch(err) { 203 | error("Failed to start function with error: " + err.message ? err.message : err.toString()); 204 | return; 205 | } 206 | 207 | success(`Visit http://localhost:${port}/ to execute your function.`); 208 | } 209 | 210 | async function dockerCleanup(functionId) { 211 | await dockerStop(functionId); 212 | 213 | const func = localConfig.getFunction(functionId); 214 | const appwritePath = path.join(localConfig.getDirname(), func.path, '.appwrite'); 215 | if (fs.existsSync(appwritePath)) { 216 | fs.rmSync(appwritePath, { recursive: true, force: true }); 217 | } 218 | 219 | const tempPath = path.join(localConfig.getDirname(), func.path, 'code.tar.gz'); 220 | if (fs.existsSync(tempPath)) { 221 | fs.rmSync(tempPath, { force: true }); 222 | } 223 | } 224 | 225 | function waitUntilPortOpen(port, iteration = 0) { 226 | return new Promise((resolve, reject) => { 227 | const client = new net.Socket(); 228 | 229 | client.once('connect', () => { 230 | client.removeAllListeners('connect'); 231 | client.removeAllListeners('error'); 232 | client.end(); 233 | client.destroy(); 234 | client.unref(); 235 | 236 | resolve(); 237 | }); 238 | 239 | client.once('error', async (err) => { 240 | client.removeAllListeners('connect'); 241 | client.removeAllListeners('error'); 242 | client.end(); 243 | client.destroy(); 244 | client.unref(); 245 | 246 | if(iteration > 100) { 247 | reject(err); 248 | } else { 249 | await new Promise((res) => setTimeout(res, 100)); 250 | waitUntilPortOpen(port, iteration + 1).then(resolve).catch(reject); 251 | } 252 | }); 253 | 254 | client.connect({port, host: '127.0.0.1'}, function() {}); 255 | }); 256 | } 257 | 258 | module.exports = { 259 | dockerPull, 260 | dockerBuild, 261 | dockerStart, 262 | dockerCleanup, 263 | dockerStop, 264 | } 265 | -------------------------------------------------------------------------------- /lib/emulation/utils.js: -------------------------------------------------------------------------------- 1 | const EventEmitter = require('node:events'); 2 | const { projectsCreateJWT } = require('../commands/projects'); 3 | const { localConfig } = require("../config"); 4 | const { usersGet, usersCreateJWT } = require("../commands/users"); 5 | const { log } = require("../parser"); 6 | 7 | const openRuntimesVersion = 'v4'; 8 | 9 | const runtimeNames = { 10 | 'node': 'Node.js', 11 | 'php': 'PHP', 12 | 'ruby': 'Ruby', 13 | 'python': 'Python', 14 | 'python-ml': 'Python (ML)', 15 | 'deno': 'Deno', 16 | 'dart': 'Dart', 17 | 'dotnet': '.NET', 18 | 'java': 'Java', 19 | 'swift': 'Swift', 20 | 'kotlin': 'Kotlin', 21 | 'bun': 'Bun', 22 | 'go': 'Go', 23 | }; 24 | 25 | const systemTools = { 26 | 'node': { 27 | isCompiled: false, 28 | startCommand: "sh helpers/server.sh", 29 | dependencyFiles: [ "package.json", "package-lock.json" ] 30 | }, 31 | 'php': { 32 | isCompiled: false, 33 | startCommand: "sh helpers/server.sh", 34 | dependencyFiles: [ "composer.json", "composer.lock" ] 35 | }, 36 | 'ruby': { 37 | isCompiled: false, 38 | startCommand: "sh helpers/server.sh", 39 | dependencyFiles: [ "Gemfile", "Gemfile.lock" ] 40 | }, 41 | 'python': { 42 | isCompiled: false, 43 | startCommand: "sh helpers/server.sh", 44 | dependencyFiles: [ "requirements.txt", "requirements.lock" ] 45 | }, 46 | 'python-ml': { 47 | isCompiled: false, 48 | startCommand: "sh helpers/server.sh", 49 | dependencyFiles: [ "requirements.txt", "requirements.lock" ] 50 | }, 51 | 'deno': { 52 | isCompiled: false, 53 | startCommand: "sh helpers/server.sh", 54 | dependencyFiles: [ ] 55 | }, 56 | 'dart': { 57 | isCompiled: true, 58 | startCommand: "sh helpers/server.sh", 59 | dependencyFiles: [ ] 60 | }, 61 | 'dotnet': { 62 | isCompiled: true, 63 | startCommand: "sh helpers/server.sh", 64 | dependencyFiles: [ ] 65 | }, 66 | 'java': { 67 | isCompiled: true, 68 | startCommand: "sh helpers/server.sh", 69 | dependencyFiles: [ ] 70 | }, 71 | 'swift': { 72 | isCompiled: true, 73 | startCommand: "sh helpers/server.sh", 74 | dependencyFiles: [ ] 75 | }, 76 | 'kotlin': { 77 | isCompiled: true, 78 | startCommand: "sh helpers/server.sh", 79 | dependencyFiles: [ ] 80 | }, 81 | 'bun': { 82 | isCompiled: false, 83 | startCommand: "sh helpers/server.sh", 84 | dependencyFiles: [ "package.json", "package-lock.json", "bun.lockb" ] 85 | }, 86 | 'go': { 87 | isCompiled: true, 88 | startCommand: "sh helpers/server.sh", 89 | dependencyFiles: [ ] 90 | }, 91 | }; 92 | 93 | const JwtManager = { 94 | userJwt: null, 95 | functionJwt: null, 96 | 97 | timerWarn: null, 98 | timerError: null, 99 | 100 | async setup(userId = null, projectScopes = []) { 101 | if(this.timerWarn) { 102 | clearTimeout(this.timerWarn); 103 | } 104 | 105 | if(this.timerError) { 106 | clearTimeout(this.timerError); 107 | } 108 | 109 | this.timerWarn = setTimeout(() => { 110 | log("Warning: Authorized JWT will expire in 5 minutes. Please stop and re-run the command to refresh tokens for 1 hour."); 111 | }, 1000 * 60 * 55); // 55 mins 112 | 113 | this.timerError = setTimeout(() => { 114 | log("Warning: Authorized JWT just expired. Please stop and re-run the command to obtain new tokens with 1 hour validity."); 115 | log("Some Appwrite API communication is not authorized now.") 116 | }, 1000 * 60 * 60); // 60 mins 117 | 118 | if(userId) { 119 | await usersGet({ 120 | userId, 121 | parseOutput: false 122 | }); 123 | const userResponse = await usersCreateJWT({ 124 | userId, 125 | duration: 60*60, 126 | parseOutput: false 127 | }); 128 | this.userJwt = userResponse.jwt; 129 | } 130 | 131 | const functionResponse = await projectsCreateJWT({ 132 | projectId: localConfig.getProject().projectId, 133 | scopes: projectScopes, 134 | duration: 60*60, 135 | parseOutput: false 136 | }); 137 | this.functionJwt = functionResponse.jwt; 138 | } 139 | }; 140 | 141 | const Queue = { 142 | files: [], 143 | locked: false, 144 | events: new EventEmitter(), 145 | debounce: null, 146 | push(file) { 147 | if(!this.files.includes(file)) { 148 | this.files.push(file); 149 | } 150 | 151 | if(!this.locked) { 152 | this._trigger(); 153 | } 154 | }, 155 | lock() { 156 | this.files = []; 157 | this.locked = true; 158 | }, 159 | isEmpty() { 160 | return this.files.length === 0 161 | }, 162 | unlock() { 163 | this.locked = false; 164 | if(this.files.length > 0) { 165 | this._trigger(); 166 | } 167 | }, 168 | _trigger() { 169 | if(this.debounce) { 170 | return; 171 | } 172 | 173 | this.debounce = setTimeout(() => { 174 | this.events.emit('reload', { files: this.files }); 175 | this.debounce = null; 176 | }, 300); 177 | } 178 | }; 179 | 180 | module.exports = { 181 | openRuntimesVersion, 182 | runtimeNames, 183 | systemTools, 184 | JwtManager, 185 | Queue 186 | } 187 | -------------------------------------------------------------------------------- /lib/exception.js: -------------------------------------------------------------------------------- 1 | class AppwriteException extends Error { 2 | constructor(message, code, response) { 3 | super(message); 4 | this.code = code; 5 | this.response = response; 6 | } 7 | } 8 | 9 | module.exports = AppwriteException; -------------------------------------------------------------------------------- /lib/id.js: -------------------------------------------------------------------------------- 1 | class ID { 2 | // Generate an hex ID based on timestamp 3 | // Recreated from https://www.php.net/manual/en/function.uniqid.php 4 | static #hexTimestamp() { 5 | const now = new Date(); 6 | const sec = Math.floor(now.getTime() / 1000); 7 | const msec = now.getMilliseconds(); 8 | 9 | // Convert to hexadecimal 10 | const hexTimestamp = sec.toString(16) + msec.toString(16).padStart(5, '0'); 11 | return hexTimestamp; 12 | } 13 | 14 | static custom(id) { 15 | return id 16 | } 17 | 18 | static unique(padding = 7) { 19 | // Generate a unique ID with padding to have a longer ID 20 | const baseId = ID.#hexTimestamp(); 21 | let randomPadding = ''; 22 | for (let i = 0; i < padding; i++) { 23 | const randomHexDigit = Math.floor(Math.random() * 16).toString(16); 24 | randomPadding += randomHexDigit; 25 | } 26 | return baseId + randomPadding; 27 | } 28 | } 29 | 30 | module.exports = ID; 31 | -------------------------------------------------------------------------------- /lib/paginate.js: -------------------------------------------------------------------------------- 1 | const paginate = async (action, args = {}, limit = 100, wrapper = '', queries = []) => { 2 | let pageNumber = 0; 3 | let results = []; 4 | let total = 0; 5 | 6 | while (true) { 7 | const offset = pageNumber * limit; 8 | 9 | // Merge the limit and offset into the args 10 | const response = await action({ 11 | ...args, 12 | queries: [ 13 | ...queries, 14 | JSON.stringify({ method: 'limit', values: [limit] }), 15 | JSON.stringify({ method: 'offset', values: [offset] }) 16 | ] 17 | }); 18 | 19 | if (wrapper === '') { 20 | if (response.length === 0) { 21 | break; 22 | } 23 | results = results.concat(response); 24 | } else { 25 | if (response[wrapper].length === 0) { 26 | break; 27 | } 28 | results = results.concat(response[wrapper]); 29 | } 30 | 31 | total = response.total; 32 | 33 | if (results.length >= total) { 34 | break; 35 | } 36 | 37 | pageNumber++; 38 | } 39 | 40 | if (wrapper === '') { 41 | return results; 42 | } 43 | 44 | return { 45 | [wrapper]: results, 46 | total, 47 | }; 48 | } 49 | 50 | module.exports = { 51 | paginate 52 | }; 53 | -------------------------------------------------------------------------------- /lib/sdks.js: -------------------------------------------------------------------------------- 1 | const Client = require("./client"); 2 | const { globalConfig, localConfig } = require("./config"); 3 | 4 | const sdkForConsole = async (requiresAuth = true) => { 5 | let client = new Client(); 6 | let endpoint = globalConfig.getEndpoint(); 7 | let cookie = globalConfig.getCookie() 8 | let selfSigned = globalConfig.getSelfSigned() 9 | 10 | if (requiresAuth && cookie === "") { 11 | throw new Error("Session not found. Please run `appwrite login` to create a session"); 12 | } 13 | 14 | client 15 | .setEndpoint(endpoint) 16 | .setCookie(cookie) 17 | .setProject("console") 18 | .setSelfSigned(selfSigned) 19 | .setLocale("en-US"); 20 | 21 | return client; 22 | }; 23 | 24 | const sdkForProject = async () => { 25 | let client = new Client(); 26 | let endpoint = globalConfig.getEndpoint(); 27 | let project = localConfig.getProject().projectId ? localConfig.getProject().projectId : globalConfig.getProject(); 28 | let key = globalConfig.getKey(); 29 | let cookie = globalConfig.getCookie() 30 | let selfSigned = globalConfig.getSelfSigned() 31 | 32 | if (!project) { 33 | throw new Error("Project is not set. Please run `appwrite init project` to initialize the current directory with an Appwrite project."); 34 | } 35 | 36 | client 37 | .setEndpoint(endpoint) 38 | .setProject(project) 39 | .setSelfSigned(selfSigned) 40 | .setLocale("en-US"); 41 | 42 | if (cookie) { 43 | return client 44 | .setCookie(cookie) 45 | .setMode("admin"); 46 | } 47 | 48 | if (key) { 49 | return client 50 | .setKey(key) 51 | .setMode("default"); 52 | } 53 | 54 | throw new Error("Session not found. Please run `appwrite login` to create a session."); 55 | }; 56 | 57 | module.exports = { 58 | sdkForConsole, 59 | sdkForProject, 60 | }; 61 | -------------------------------------------------------------------------------- /lib/spinner.js: -------------------------------------------------------------------------------- 1 | const progress = require('cli-progress'); 2 | const chalk = require('chalk'); 3 | 4 | const SPINNER_ARC = 'arc'; 5 | const SPINNER_DOTS = 'dots'; 6 | 7 | const spinners = { 8 | [SPINNER_ARC]: { 9 | "interval": 100, 10 | "frames": ["◜", "◠", "◝", "◞", "◡", "◟"] 11 | }, 12 | [SPINNER_DOTS]: { 13 | "interval": 80, 14 | "frames": ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"] 15 | } 16 | } 17 | 18 | class Spinner { 19 | static start(clearOnComplete = true, hideCursor = true) { 20 | Spinner.updatesBar = new progress.MultiBar({ 21 | format: this.#formatter, 22 | hideCursor, 23 | clearOnComplete, 24 | stopOnComplete: true, 25 | linewrap: true, 26 | noTTYOutput: true 27 | }); 28 | } 29 | 30 | static stop() { 31 | Spinner.updatesBar.stop(); 32 | } 33 | 34 | static #formatter(options, params, payload) { 35 | const status = payload.status.padEnd(12); 36 | const middle = `${payload.resource} (${payload.id})`.padEnd(40); 37 | 38 | let prefix = chalk.cyan(payload.prefix ?? '⧗'); 39 | let start = chalk.cyan(status); 40 | let end = chalk.yellow(payload.end); 41 | 42 | if (status.toLowerCase().trim() === 'pushed') { 43 | start = chalk.greenBright.bold(status); 44 | prefix = chalk.greenBright.bold('✓'); 45 | end = ''; 46 | } else if (status.toLowerCase().trim() === 'deploying') { 47 | start = chalk.cyanBright.bold(status); 48 | } else if (status.toLowerCase().trim() === 'deployed') { 49 | start = chalk.green.bold(status); 50 | prefix = chalk.green.bold('✓'); 51 | } else if (status.toLowerCase().trim() === 'error') { 52 | start = chalk.red.bold(status); 53 | prefix = chalk.red.bold('✗'); 54 | end = chalk.red(payload.errorMessage); 55 | } 56 | 57 | return Spinner.#line(prefix, start, middle, end); 58 | } 59 | 60 | static #line(prefix, start, middle, end, separator = '•') { 61 | return `${prefix} ${start} ${separator} ${middle} ${!end ? '' : separator} ${end}`; 62 | 63 | } 64 | 65 | constructor(payload, total = 100, startValue = 0) { 66 | this.bar = Spinner.updatesBar.create(total, startValue, payload) 67 | } 68 | 69 | update(payload) { 70 | this.bar.update(payload); 71 | return this; 72 | } 73 | 74 | fail(payload) { 75 | this.stopSpinner(); 76 | this.update({ status: 'Error', ...payload }); 77 | } 78 | 79 | startSpinner(name) { 80 | let spinnerFrame = 1; 81 | const spinner = spinners[name] ?? spinners['dots']; 82 | 83 | this.spinnerInterval = setInterval(() => { 84 | if (spinnerFrame === spinner.frames.length) spinnerFrame = 1; 85 | this.bar.update({ prefix: spinner.frames[spinnerFrame++] }); 86 | }, spinner.interval); 87 | } 88 | 89 | stopSpinner() { 90 | clearInterval(this.spinnerInterval); 91 | } 92 | 93 | replaceSpinner(name) { 94 | this.stopSpinner(); 95 | this.startSpinner(name); 96 | } 97 | } 98 | 99 | 100 | module.exports = { 101 | Spinner, 102 | SPINNER_ARC, 103 | SPINNER_DOTS 104 | } 105 | -------------------------------------------------------------------------------- /lib/utils.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const path = require("path"); 3 | const net = require("net"); 4 | const childProcess = require('child_process'); 5 | const { localConfig, globalConfig } = require("./config"); 6 | const { success } = require('./parser') 7 | 8 | function getAllFiles(folder) { 9 | const files = []; 10 | for (const pathDir of fs.readdirSync(folder)) { 11 | const pathAbsolute = path.join(folder, pathDir); 12 | let stats; 13 | try { 14 | stats = fs.statSync(pathAbsolute); 15 | } catch (error) { 16 | continue; 17 | } 18 | if (stats.isDirectory()) { 19 | files.push(...getAllFiles(pathAbsolute)); 20 | } else { 21 | files.push(pathAbsolute); 22 | } 23 | } 24 | return files; 25 | } 26 | 27 | async function isPortTaken(port) { 28 | const taken = await new Promise((res, rej) => { 29 | const tester = net.createServer() 30 | .once('error', function (err) { 31 | if (err.code != 'EADDRINUSE') return rej(err) 32 | res(true) 33 | }) 34 | .once('listening', function() { 35 | tester.once('close', function() { res(false) }) 36 | .close() 37 | }) 38 | .listen(port); 39 | }); 40 | 41 | return taken; 42 | } 43 | 44 | function systemHasCommand(command) { 45 | const isUsingWindows = process.platform == 'win32' 46 | 47 | try { 48 | if(isUsingWindows) { 49 | childProcess.execSync('where ' + command, { stdio: 'pipe' }) 50 | } else { 51 | childProcess.execSync(`[[ $(${command} --version) ]] || { exit 1; } && echo "OK"`, { stdio: 'pipe', shell: '/bin/bash' }); 52 | } 53 | } catch (error) { 54 | console.log(error); 55 | return false; 56 | } 57 | 58 | return true; 59 | } 60 | 61 | const checkDeployConditions = (localConfig) => { 62 | if (Object.keys(localConfig.data).length === 0) { 63 | throw new Error("No appwrite.json file found in the current directory. Please run this command again in the folder containing your appwrite.json file, or run 'appwrite init project' to link current directory to an Appwrite project."); 64 | } 65 | } 66 | 67 | function showConsoleLink(serviceName, action, ...ids) { 68 | const projectId = localConfig.getProject().projectId; 69 | 70 | const url = new URL(globalConfig.getEndpoint().replace('/v1', '/console')); 71 | url.pathname += `/project-${projectId}`; 72 | action = action.toLowerCase(); 73 | 74 | switch (serviceName) { 75 | case "account": 76 | url.pathname = url.pathname.replace(`/project-${projectId}`, ''); 77 | url.pathname += getAccountPath(action); 78 | break; 79 | case "databases": 80 | url.pathname += getDatabasePath(action, ids); 81 | break; 82 | case "functions": 83 | url.pathname += getFunctionsPath(action, ids); 84 | break; 85 | case "messaging": 86 | url.pathname += getMessagingPath(action, ids); 87 | break; 88 | case "projects": 89 | url.pathname = url.pathname.replace(`/project-${projectId}`, ''); 90 | url.pathname += getProjectsPath(action, ids); 91 | break; 92 | case "storage": 93 | url.pathname += getBucketsPath(action, ids); 94 | break; 95 | case "teams": 96 | url.pathname += getTeamsPath(action, ids); 97 | break; 98 | case "organizations": 99 | url.pathname += getOrganizationsPath(action, ids); 100 | break; 101 | case "users": 102 | url.pathname += getUsersPath(action, ids); 103 | break; 104 | default: 105 | return; 106 | } 107 | 108 | 109 | success(url); 110 | } 111 | 112 | function getAccountPath(action) { 113 | let path = '/account'; 114 | 115 | if (action === 'listsessions') { 116 | path += '/sessions'; 117 | } 118 | 119 | return path; 120 | } 121 | 122 | function getDatabasePath(action, ids) { 123 | let path = '/databases'; 124 | 125 | 126 | if (['get', 'listcollections', 'getcollection', 'listattributes', 'listdocuments', 'getdocument', 'listindexes', 'getdatabaseusage'].includes(action)) { 127 | path += `/database-${ids[0]}`; 128 | } 129 | 130 | if (action === 'getdatabaseusage') { 131 | path += `/usage`; 132 | } 133 | 134 | if (['getcollection', 'listattributes', 'listdocuments', 'getdocument', 'listindexes'].includes(action)) { 135 | path += `/collection-${ids[1]}`; 136 | } 137 | 138 | if (action === 'listattributes') { 139 | path += '/attributes'; 140 | } 141 | if (action === 'listindexes') { 142 | path += '/indexes'; 143 | } 144 | if (action === 'getdocument') { 145 | path += `/document-${ids[2]}`; 146 | } 147 | 148 | 149 | return path; 150 | } 151 | 152 | function getFunctionsPath(action, ids) { 153 | let path = '/functions'; 154 | 155 | if (action !== 'list') { 156 | path += `/function-${ids[0]}`; 157 | } 158 | 159 | if (action === 'getdeployment') { 160 | path += `/deployment-${ids[1]}` 161 | } 162 | 163 | if (action === 'getexecution' || action === 'listexecution') { 164 | path += `/executions` 165 | } 166 | if (action === 'getfunctionusage') { 167 | path += `/usage` 168 | } 169 | 170 | return path; 171 | } 172 | 173 | function getMessagingPath(action, ids) { 174 | let path = '/messaging'; 175 | 176 | if (['getmessage', 'listmessagelogs'].includes(action)) { 177 | path += `/message-${ids[0]}`; 178 | } 179 | 180 | if (['listproviders', 'getprovider'].includes(action)) { 181 | path += `/providers`; 182 | } 183 | 184 | if (action === 'getprovider') { 185 | path += `/provider-${ids[0]}`; 186 | } 187 | 188 | if (['listtopics', 'gettopic'].includes(action)) { 189 | path += `/topics`; 190 | } 191 | 192 | if (action === 'gettopic') { 193 | path += `/topic-${ids[0]}`; 194 | } 195 | 196 | return path; 197 | } 198 | 199 | function getProjectsPath(action, ids) { 200 | let path = ''; 201 | 202 | if (action !== 'list') { 203 | path += `/project-${ids[0]}`; 204 | } 205 | 206 | if (['listkeys', 'getkey'].includes(action)) { 207 | path += '/overview/keys' 208 | } 209 | 210 | if (['listplatforms', 'getplatform'].includes(action)) { 211 | path += '/overview/platforms' 212 | } 213 | 214 | if (['listwebhooks', 'getwebhook'].includes(action)) { 215 | path += '/settings/webhooks' 216 | } 217 | 218 | if (['getplatform', 'getkey', 'getwebhook'].includes(action)) { 219 | path += `/${ids[1]}`; 220 | } 221 | 222 | return path; 223 | } 224 | 225 | function getBucketsPath(action, ids) { 226 | let path = '/storage'; 227 | 228 | if (action !== 'listbuckets') { 229 | path += `/bucket-${ids[0]}`; 230 | } 231 | 232 | if (action === 'getbucketusage') { 233 | path += `/usage` 234 | } 235 | 236 | if (action === 'getfile') { 237 | path += `/file-${ids[1]}` 238 | } 239 | 240 | return path; 241 | } 242 | 243 | function getTeamsPath(action, ids) { 244 | let path = '/auth/teams'; 245 | 246 | if (action !== 'list') { 247 | path += `/team-${ids[0]}`; 248 | } 249 | 250 | return path; 251 | } 252 | 253 | function getOrganizationsPath(action, ids) { 254 | let path = `/organization-${ids[0]}`; 255 | 256 | if (action === 'list') { 257 | path = '/account/organizations'; 258 | } 259 | 260 | return path; 261 | } 262 | 263 | function getUsersPath(action, ids) { 264 | let path = '/auth'; 265 | 266 | if (action !== 'list') { 267 | path += `/user-${ids[0]}`; 268 | } 269 | 270 | if (action === 'listsessions') { 271 | path += 'sessions'; 272 | } 273 | 274 | return path; 275 | } 276 | 277 | module.exports = { 278 | getAllFiles, 279 | isPortTaken, 280 | systemHasCommand, 281 | checkDeployConditions, 282 | showConsoleLink 283 | }; 284 | -------------------------------------------------------------------------------- /lib/validations.js: -------------------------------------------------------------------------------- 1 | const validateRequired = (resource, value) => { 2 | if (Array.isArray(value)) { 3 | if (value.length <= 0) { 4 | return `Please select at least one ${resource}`; 5 | } 6 | } else { 7 | if (value === undefined || value === null || value === 0 || (typeof value === "string" && value.trim() === '')) { 8 | return `${resource} is required`; 9 | } 10 | } 11 | 12 | return true; 13 | } 14 | 15 | module.exports = { 16 | validateRequired 17 | } 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "appwrite-cli", 3 | "homepage": "https://appwrite.io/support", 4 | "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API", 5 | "version": "7.0.0", 6 | "license": "BSD-3-Clause", 7 | "main": "index.js", 8 | "bin": { 9 | "appwrite": "index.js" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/appwrite/sdk-for-cli" 14 | }, 15 | "scripts": { 16 | "test": "echo \"Error: no test specified\" && exit 1", 17 | "linux-x64": "pkg -t node18-linux-x64 -o build/appwrite-cli-linux-x64 package.json", 18 | "linux-arm64": "pkg -t node18-linux-arm64 -o build/appwrite-cli-linux-arm64 package.json", 19 | "mac-x64": "pkg -t node18-macos-x64 -o build/appwrite-cli-darwin-x64 package.json", 20 | "mac-arm64": "pkg -t node18-macos-arm64 -o build/appwrite-cli-darwin-arm64 package.json", 21 | "windows-x64": "pkg -t node18-win-x64 -o build/appwrite-cli-win-x64.exe package.json", 22 | "windows-arm64": "pkg -t node18-win-arm64 -o build/appwrite-cli-win-arm64.exe package.json" 23 | }, 24 | "dependencies": { 25 | "undici": "^5.28.2", 26 | "chalk": "4.1.2", 27 | "cli-progress": "^3.12.0", 28 | "cli-table3": "^0.6.2", 29 | "commander": "^9.2.0", 30 | "form-data": "^4.0.0", 31 | "json-bigint": "^1.0.0", 32 | "inquirer": "^8.2.4", 33 | "inquirer-search-list": "^1.2.6", 34 | "tar": "^6.1.11", 35 | "ignore": "^5.2.0", 36 | "chokidar": "^3.6.0", 37 | "tail": "^2.2.6", 38 | "dotenv": "^16.4.5" 39 | }, 40 | "devDependencies": { 41 | "pkg": "5.8.1" 42 | }, 43 | "pkg": { 44 | "scripts": [ 45 | "index.js", 46 | "lib/**/*.js" 47 | ] 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /scoop/appwrite.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/schema.json", 3 | "version": "7.0.0", 4 | "description": "The Appwrite CLI is a command-line application that allows you to interact with Appwrite and perform server-side tasks using your terminal.", 5 | "homepage": "https://github.com/appwrite/sdk-for-cli", 6 | "license": "BSD-3-Clause", 7 | "architecture": { 8 | "64bit": { 9 | "url": "https://github.com/appwrite/sdk-for-cli/releases/download/7.0.0/appwrite-cli-win-x64.exe", 10 | "bin": [ 11 | [ 12 | "appwrite-cli-win-x64.exe", 13 | "appwrite" 14 | ] 15 | ] 16 | }, 17 | "arm64": { 18 | "url": "https://github.com/appwrite/sdk-for-cli/releases/download/7.0.0/appwrite-cli-win-arm64.exe", 19 | "bin": [ 20 | [ 21 | "appwrite-cli-win-arm64.exe", 22 | "appwrite" 23 | ] 24 | ] 25 | } 26 | }, 27 | "checkver": { 28 | "github": "https://github.com/appwrite/sdk-for-cli" 29 | } 30 | } --------------------------------------------------------------------------------